Search in sources :

Example 1 with Configuration

use of org.janusgraph.diskstorage.configuration.Configuration in project janusgraph by JanusGraph.

the class KeyColumnValueStoreTest method scanTestWithSimpleJob.

@Test
public void scanTestWithSimpleJob() throws Exception {
    int keys = 1000, columns = 40;
    String[][] values = KeyValueStoreUtil.generateData(keys, columns);
    // Make it only half the number of columns for every 2nd key
    for (int i = 0; i < values.length; i++) {
        if (i % 2 == 0)
            values[i] = Arrays.copyOf(values[i], columns / 2);
    }
    log.debug("Loading values: " + keys + "x" + columns);
    loadValues(values);
    clopen();
    StandardScanner scanner = new StandardScanner(manager);
    SimpleScanJobRunner runner = (ScanJob job, Configuration jobConf, String rootNSName) -> runSimpleJob(scanner, job, jobConf);
    SimpleScanJob.runBasicTests(keys, columns, runner);
}
Also used : StandardScanner(org.janusgraph.diskstorage.keycolumnvalue.scan.StandardScanner) Configuration(org.janusgraph.diskstorage.configuration.Configuration) ScanJob(org.janusgraph.diskstorage.keycolumnvalue.scan.ScanJob)

Example 2 with Configuration

use of org.janusgraph.diskstorage.configuration.Configuration in project janusgraph by JanusGraph.

the class RidGenerationTest method testThreadBasedRidGeneration.

@Test
public void testThreadBasedRidGeneration() throws InterruptedException {
    Configuration c = Configuration.EMPTY;
    // n <= 1 is useless
    final int n = 8;
    Collection<byte[]> rids = Collections.synchronizedSet(new HashSet<byte[]>());
    RidThread[] threads = new RidThread[n];
    for (int i = 0; i < n; i++) {
        threads[i] = new RidThread(rids, c);
    }
    for (int i = 0; i < n; i++) {
        threads[i].start();
    }
    for (int i = 0; i < n; i++) {
        threads[i].join();
    }
// TODO: rewrite test case in terms of GraphDatabaseConfiguration
// assertEquals(n, rids.size());
}
Also used : Configuration(org.janusgraph.diskstorage.configuration.Configuration) Test(org.junit.Test)

Example 3 with Configuration

use of org.janusgraph.diskstorage.configuration.Configuration in project janusgraph by JanusGraph.

the class HadoopScanMapper method setup.

@Override
protected void setup(Context context) throws IOException, InterruptedException {
    super.setup(context);
    org.apache.hadoop.conf.Configuration hadoopConf = DEFAULT_COMPAT.getContextConfiguration(context);
    ModifiableHadoopConfiguration scanConf = ModifiableHadoopConfiguration.of(JanusGraphHadoopConfiguration.MAPRED_NS, hadoopConf);
    job = getJob(scanConf);
    metrics = new HadoopContextScanMetrics(context);
    Configuration graphConf = getJanusGraphConfiguration(context);
    finishSetup(scanConf, graphConf);
}
Also used : Configuration(org.janusgraph.diskstorage.configuration.Configuration) ModifiableHadoopConfiguration(org.janusgraph.hadoop.config.ModifiableHadoopConfiguration) JanusGraphHadoopConfiguration(org.janusgraph.hadoop.config.JanusGraphHadoopConfiguration) ModifiableConfiguration(org.janusgraph.diskstorage.configuration.ModifiableConfiguration) ModifiableHadoopConfiguration(org.janusgraph.hadoop.config.ModifiableHadoopConfiguration)

Example 4 with Configuration

use of org.janusgraph.diskstorage.configuration.Configuration in project janusgraph by JanusGraph.

the class CQLStoreManager method initializeSession.

Session initializeSession(final String keyspaceName) {
    final Configuration configuration = getStorageConfig();
    final Map<String, Object> replication = Match(configuration.get(REPLICATION_STRATEGY)).of(Case($("SimpleStrategy"), strategy -> HashMap.<String, Object>of("class", strategy, "replication_factor", configuration.get(REPLICATION_FACTOR))), Case($("NetworkTopologyStrategy"), strategy -> HashMap.<String, Object>of("class", strategy).merge(Array.of(configuration.get(REPLICATION_OPTIONS)).grouped(2).toMap(array -> Tuple.of(array.get(0), Integer.parseInt(array.get(1))))))).toJavaMap();
    final Session s = this.cluster.connect();
    s.execute(createKeyspace(keyspaceName).ifNotExists().with().replication(replication));
    return s;
}
Also used : GraphDatabaseConfiguration.buildGraphConfiguration(org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration.buildGraphConfiguration) Configuration(org.janusgraph.diskstorage.configuration.Configuration) Session(com.datastax.driver.core.Session)

Example 5 with Configuration

use of org.janusgraph.diskstorage.configuration.Configuration in project janusgraph by JanusGraph.

the class ElasticSearchConfigTest method testIndexCreationOptions.

@Test
public void testIndexCreationOptions() throws InterruptedException, BackendException, IOException {
    final int shards = 7;
    final CommonsConfiguration cc = new CommonsConfiguration(new BaseConfiguration());
    cc.set("index." + INDEX_NAME + ".elasticsearch.create.ext.number_of_shards", String.valueOf(shards));
    final ModifiableConfiguration config = new ModifiableConfiguration(GraphDatabaseConfiguration.ROOT_NS, cc, BasicConfiguration.Restriction.NONE);
    esr.setElasticsearchConfiguration(config, INDEX_NAME);
    final Configuration indexConfig = config.restrictTo(INDEX_NAME);
    final IndexProvider idx = open(indexConfig);
    simpleWriteAndQuery(idx);
    idx.close();
    final ElasticSearchClient client = ElasticSearchSetup.REST_CLIENT.connect(indexConfig).getClient();
    assertEquals(String.valueOf(shards), client.getIndexSettings("janusgraph_jvmlocal_test_store").get("number_of_shards"));
    client.close();
}
Also used : BaseConfiguration(org.apache.commons.configuration.BaseConfiguration) BaseConfiguration(org.apache.commons.configuration.BaseConfiguration) Configuration(org.janusgraph.diskstorage.configuration.Configuration) CommonsConfiguration(org.janusgraph.diskstorage.configuration.backend.CommonsConfiguration) GraphDatabaseConfiguration(org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration) BasicConfiguration(org.janusgraph.diskstorage.configuration.BasicConfiguration) ModifiableConfiguration(org.janusgraph.diskstorage.configuration.ModifiableConfiguration) CommonsConfiguration(org.janusgraph.diskstorage.configuration.backend.CommonsConfiguration) ModifiableConfiguration(org.janusgraph.diskstorage.configuration.ModifiableConfiguration) Test(org.junit.Test)

Aggregations

Configuration (org.janusgraph.diskstorage.configuration.Configuration)18 GraphDatabaseConfiguration (org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration)11 ModifiableConfiguration (org.janusgraph.diskstorage.configuration.ModifiableConfiguration)9 Test (org.junit.Test)9 BaseConfiguration (org.apache.commons.configuration.BaseConfiguration)8 BasicConfiguration (org.janusgraph.diskstorage.configuration.BasicConfiguration)8 CommonsConfiguration (org.janusgraph.diskstorage.configuration.backend.CommonsConfiguration)8 BaseTransactionConfig (org.janusgraph.diskstorage.BaseTransactionConfig)5 PermanentBackendException (org.janusgraph.diskstorage.PermanentBackendException)5 ElasticSearchIndex (org.janusgraph.diskstorage.es.ElasticSearchIndex)5 BackendException (org.janusgraph.diskstorage.BackendException)4 IOException (java.io.IOException)3 StandardStoreFeatures (org.janusgraph.diskstorage.keycolumnvalue.StandardStoreFeatures)3 StandardBaseTransactionConfig (org.janusgraph.diskstorage.util.StandardBaseTransactionConfig)3 Session (com.datastax.driver.core.Session)2 Duration (java.time.Duration)2 List (java.util.List)2 HttpPut (org.apache.http.client.methods.HttpPut)2 StringEntity (org.apache.http.entity.StringEntity)2 StoreTransaction (org.janusgraph.diskstorage.keycolumnvalue.StoreTransaction)2