Search in sources :

Example 6 with GraknConfig

use of ai.grakn.engine.GraknConfig in project grakn by graknlabs.

the class ConfigProcessor method updateQueueConfig.

public static void updateQueueConfig() {
    GraknConfig graknConfig = Configs.graknConfig();
    String updatedQueueConfigString = Configs.queueConfig().updateFromConfig(graknConfig).toConfigString();
    saveConfigStringToFile(updatedQueueConfigString, Configs.queueConfigPath());
}
Also used : GraknConfig(ai.grakn.engine.GraknConfig)

Example 7 with GraknConfig

use of ai.grakn.engine.GraknConfig in project grakn by graknlabs.

the class EmbeddedGraknSession method getTxRemoteConfig.

/**
 * Gets the properties needed to create a {@link GraknTx} by pinging engine for the config file
 *
 * @return the properties needed to build a {@link GraknTx}
 */
private static GraknConfig getTxRemoteConfig(SimpleURI uri, Keyspace keyspace) {
    URI keyspaceUri = UriBuilder.fromUri(uri.toURI()).path(REST.resolveTemplate(REST.WebPath.KB_KEYSPACE, keyspace.getValue())).build();
    Properties properties = new Properties();
    // Get Specific Configs
    properties.putAll(read(contactEngine(Optional.of(keyspaceUri), REST.HttpConn.PUT_METHOD)).asMap());
    GraknConfig config = GraknConfig.of(properties);
    // Overwrite Engine IP with something which is remotely accessible
    config.setConfigProperty(GraknConfigKey.SERVER_HOST_NAME, uri.getHost());
    config.setConfigProperty(GraknConfigKey.SERVER_PORT, uri.getPort());
    return config;
}
Also used : GraknConfig(ai.grakn.engine.GraknConfig) Properties(java.util.Properties) URI(java.net.URI) SimpleURI(ai.grakn.util.SimpleURI)

Example 8 with GraknConfig

use of ai.grakn.engine.GraknConfig in project grakn by graknlabs.

the class EmbeddedGraknSession method getTxInMemoryConfig.

/**
 * Gets properties which let you build a toy in-mempoty {@link GraknTx}.
 * This does nto contact engine in anyway and can be run in an isolated manner
 *
 * @return the properties needed to build an in-memory {@link GraknTx}
 */
static GraknConfig getTxInMemoryConfig() {
    GraknConfig config = GraknConfig.empty();
    config.setConfigProperty(GraknConfigKey.SHARDING_THRESHOLD, 100_000L);
    config.setConfigProperty(GraknConfigKey.SESSION_CACHE_TIMEOUT_MS, 30_000);
    config.setConfigProperty(GraknConfigKey.KB_MODE, GraknTxFactoryBuilder.IN_MEMORY);
    config.setConfigProperty(GraknConfigKey.KB_ANALYTICS, GraknTxFactoryBuilder.IN_MEMORY);
    return config;
}
Also used : GraknConfig(ai.grakn.engine.GraknConfig)

Aggregations

GraknConfig (ai.grakn.engine.GraknConfig)8 SimpleURI (ai.grakn.util.SimpleURI)2 Grakn (ai.grakn.bootup.graknengine.Grakn)1 GraknSessionProvider (ai.grakn.graql.shell.GraknSessionProvider)1 GraqlShellOptions (ai.grakn.graql.shell.GraqlShellOptions)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 File (java.io.File)1 InputStream (java.io.InputStream)1 OutputStream (java.io.OutputStream)1 PrintStream (java.io.PrintStream)1 URI (java.net.URI)1 Properties (java.util.Properties)1 ZipFile (net.lingala.zip4j.core.ZipFile)1 TeeOutputStream (org.apache.commons.io.output.TeeOutputStream)1 BeforeClass (org.junit.BeforeClass)1