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);
}
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);
}
Aggregations