org.apache.tinkerpop.gremlin.hadoop.structure.io.HadoopPoolsConfigurable Java Examples

The following examples show how to use org.apache.tinkerpop.gremlin.hadoop.structure.io.HadoopPoolsConfigurable. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: InputFormatCQL.java    From grakn with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void setConf(Configuration config) {
    this.hadoopConf = config;
    HadoopPoolsConfigurable.super.setConf(config);
    ModifiableConfigurationHadoop mrConf = ModifiableConfigurationHadoop.of(ModifiableConfigurationHadoop.MAPRED_NS, config);
    BasicConfiguration janusgraphConf = mrConf.getJanusGraphConf();

    // Copy some JanusGraph configuration keys to the Hadoop Configuration keys used by Cassandra's ColumnFamilyInputFormat
    ConfigHelper.setInputInitialAddress(config, janusgraphConf.get(GraphDatabaseConfiguration.STORAGE_HOSTS)[0]);
    if (janusgraphConf.has(GraphDatabaseConfiguration.STORAGE_PORT)) {
        ConfigHelper.setInputRpcPort(config, String.valueOf(janusgraphConf.get(GraphDatabaseConfiguration.STORAGE_PORT)));
    }
    if (janusgraphConf.has(GraphDatabaseConfiguration.AUTH_USERNAME) && janusgraphConf.has(GraphDatabaseConfiguration.AUTH_PASSWORD)) {
        String username = janusgraphConf.get(GraphDatabaseConfiguration.AUTH_PASSWORD);
        if (StringUtils.isNotBlank(username)) {
            config.set(INPUT_NATIVE_AUTH_PROVIDER, PlainTextAuthProvider.class.getName());
            config.set(USERNAME, username);
            config.set(PASSWORD, janusgraphConf.get(GraphDatabaseConfiguration.AUTH_USERNAME));
        }
    }
    // Copy keyspace, force the CF setting to edgestore, honor widerows when set
    boolean wideRows = config.getBoolean(INPUT_WIDEROWS_CONFIG, false);
    // Use the setInputColumnFamily overload that includes a widerows argument; using the overload without this argument forces it false
    ConfigHelper.setInputColumnFamily(config, janusgraphConf.get(CQLConfigOptions.KEYSPACE),
                                      mrConf.get(ModifiableConfigurationHadoop.COLUMN_FAMILY_NAME), wideRows);
    LOG.debug("Set keyspace: {}", janusgraphConf.get(CQLConfigOptions.KEYSPACE));

    // Set the column slice bounds via Faunus' vertex query filter
    SlicePredicate predicate = new SlicePredicate();
    int rangeBatchSize = config.getInt(RANGE_BATCH_SIZE_CONFIG, Integer.MAX_VALUE);
    predicate.setSlice_range(getSliceRange(rangeBatchSize)); // TODO stop slicing the whole row
    ConfigHelper.setInputSlicePredicate(config, predicate);
}
 
Example #2
Source File: AbstractBinaryInputFormat.java    From titan1withtp3.1 with Apache License 2.0 5 votes vote down vote up
@Override
public void setConf(final Configuration config) {
    HadoopPoolsConfigurable.super.setConf(config);
    this.mrConf = ModifiableHadoopConfiguration.of(TitanHadoopConfiguration.MAPRED_NS, config);
    this.hadoopConf = config;
    this.titanConf = mrConf.getTitanGraphConf();
}