use of com.baidu.hugegraph.computer.core.output.ComputerOutput in project hugegraph-computer by hugegraph.
the class FileGraphPartition method output.
protected PartitionStat output() {
ComputerOutput output = this.context.config().createObject(ComputerOptions.OUTPUT_CLASS);
output.init(this.context.config(), this.partition);
try {
this.beforeOutput();
} catch (IOException e) {
throw new ComputerException("Error occurred when beforeOutput", e);
}
Value result = this.context.config().createObject(ComputerOptions.ALGORITHM_RESULT_CLASS);
while (this.vertexInput.hasNext()) {
Vertex vertex = this.vertexInput.next();
this.readVertexStatusAndValue(vertex, result);
Edges edges = this.edgesInput.edges(this.vertexInput.idPointer());
vertex.edges(edges);
output.write(vertex);
}
try {
this.afterOutput();
} catch (IOException e) {
throw new ComputerException("Error occurred when afterOutput", e);
}
output.close();
return new PartitionStat(this.partition, this.vertexCount, this.edgeCount, 0L);
}
use of com.baidu.hugegraph.computer.core.output.ComputerOutput in project hugegraph-computer by hugegraph.
the class MasterService method outputstep.
/**
* Wait the workers write result back. After this, the job is finished
* successfully.
*/
private void outputstep() {
LOG.info("{} MasterService outputstep started", this);
this.bsp4Master.waitWorkersOutputDone();
// Merge output files of multiple partitions
ComputerOutput output = this.config.createObject(ComputerOptions.OUTPUT_CLASS);
output.mergePartitions(this.config);
LOG.info("{} MasterService outputstep finished", this);
}
Aggregations