Search in sources :

Example 6 with ModifiableHadoopConfiguration

use of com.thinkaurelius.titan.hadoop.config.ModifiableHadoopConfiguration in project titan by thinkaurelius.

the class HadoopVertexScanMapper method setup.

@Override
protected void setup(Context context) throws IOException, InterruptedException {
    /* Don't call super implementation super.setup(context); */
    org.apache.hadoop.conf.Configuration hadoopConf = DEFAULT_COMPAT.getContextConfiguration(context);
    ModifiableHadoopConfiguration scanConf = ModifiableHadoopConfiguration.of(TitanHadoopConfiguration.MAPRED_NS, hadoopConf);
    VertexScanJob vertexScan = getVertexScanJob(scanConf);
    ModifiableConfiguration graphConf = getTitanConfiguration(context);
    TitanGraph graph = TitanFactory.open(graphConf);
    job = VertexJobConverter.convert(graph, vertexScan);
    metrics = new HadoopContextScanMetrics(context);
    finishSetup(scanConf, graphConf);
}
Also used : TitanGraph(com.thinkaurelius.titan.core.TitanGraph) Configuration(org.apache.hadoop.conf.Configuration) VertexScanJob(com.thinkaurelius.titan.graphdb.olap.VertexScanJob) ModifiableConfiguration(com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration) ModifiableHadoopConfiguration(com.thinkaurelius.titan.hadoop.config.ModifiableHadoopConfiguration)

Example 7 with ModifiableHadoopConfiguration

use of com.thinkaurelius.titan.hadoop.config.ModifiableHadoopConfiguration in project titan by thinkaurelius.

the class TitanH1OutputFormat method getRecordWriter.

@Override
public RecordWriter<NullWritable, VertexWritable> getRecordWriter(TaskAttemptContext taskAttemptContext) throws IOException, InterruptedException {
    synchronized (this) {
        if (null == graph) {
            Configuration hadoopConf = taskAttemptContext.getConfiguration();
            ModifiableHadoopConfiguration mhc = ModifiableHadoopConfiguration.of(TitanHadoopConfiguration.MAPRED_NS, hadoopConf);
            graph = (StandardTitanGraph) TitanFactory.open(mhc.getTitanGraphConf());
        }
    }
    // returned by VertexProgram.getComputeKeys()
    if (null == persistableKeys) {
        try {
            persistableKeys = VertexProgram.createVertexProgram(graph, ConfUtil.makeApacheConfiguration(taskAttemptContext.getConfiguration())).getElementComputeKeys();
            log.debug("Set persistableKeys={}", Joiner.on(",").join(persistableKeys));
        } catch (Exception e) {
            log.debug("Unable to detect or instantiate vertex program", e);
            persistableKeys = ImmutableSet.of();
        }
    }
    StandardTitanTx tx = transactions.computeIfAbsent(taskAttemptContext.getTaskAttemptID(), id -> (StandardTitanTx) graph.newTransaction());
    return new TitanH1RecordWriter(taskAttemptContext, tx, persistableKeys);
}
Also used : ModifiableHadoopConfiguration(com.thinkaurelius.titan.hadoop.config.ModifiableHadoopConfiguration) TitanHadoopConfiguration(com.thinkaurelius.titan.hadoop.config.TitanHadoopConfiguration) Configuration(org.apache.hadoop.conf.Configuration) ModifiableHadoopConfiguration(com.thinkaurelius.titan.hadoop.config.ModifiableHadoopConfiguration) StandardTitanTx(com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx) IOException(java.io.IOException)

Aggregations

ModifiableHadoopConfiguration (com.thinkaurelius.titan.hadoop.config.ModifiableHadoopConfiguration)7 TitanHadoopConfiguration (com.thinkaurelius.titan.hadoop.config.TitanHadoopConfiguration)3 ModifiableConfiguration (com.thinkaurelius.titan.diskstorage.configuration.ModifiableConfiguration)2 Configuration (org.apache.hadoop.conf.Configuration)2 TitanGraph (com.thinkaurelius.titan.core.TitanGraph)1 RelationTypeIndex (com.thinkaurelius.titan.core.schema.RelationTypeIndex)1 SchemaAction (com.thinkaurelius.titan.core.schema.SchemaAction)1 TitanGraphIndex (com.thinkaurelius.titan.core.schema.TitanGraphIndex)1 BackendException (com.thinkaurelius.titan.diskstorage.BackendException)1 AbstractCassandraStoreManager (com.thinkaurelius.titan.diskstorage.cassandra.AbstractCassandraStoreManager)1 Configuration (com.thinkaurelius.titan.diskstorage.configuration.Configuration)1 GraphDatabaseConfiguration (com.thinkaurelius.titan.graphdb.configuration.GraphDatabaseConfiguration)1 VertexScanJob (com.thinkaurelius.titan.graphdb.olap.VertexScanJob)1 IndexRemoveJob (com.thinkaurelius.titan.graphdb.olap.job.IndexRemoveJob)1 StandardTitanTx (com.thinkaurelius.titan.graphdb.transaction.StandardTitanTx)1 HBaseBinaryInputFormat (com.thinkaurelius.titan.hadoop.formats.hbase.HBaseBinaryInputFormat)1 HadoopScanMapper (com.thinkaurelius.titan.hadoop.scan.HadoopScanMapper)1 IOException (java.io.IOException)1 Map (java.util.Map)1 ExecutionException (java.util.concurrent.ExecutionException)1