SimpleCheckpointVertex.SimpleCheckpointVertexWorkerContext.class);
conf.setMasterComputeClass(
SimpleCheckpointVertex.SimpleCheckpointVertexMasterCompute.class);
conf.setVertexInputFormatClass(SimpleSuperstepVertexInputFormat.class);
conf.setVertexOutputFormatClass(SimpleSuperstepVertexOutputFormat.class);
GiraphJob job = prepareJob("testVertexBalancer", conf, outputPath);
job.getConfiguration().set(
PartitionBalancer.PARTITION_BALANCE_ALGORITHM,
PartitionBalancer.VERTICES_BALANCE_ALGORITHM);
assertTrue(job.run(true));
FileSystem hdfs = FileSystem.get(job.getConfiguration());
conf = new GiraphConfiguration();
conf.setVertexClass(
SimpleCheckpointVertex.SimpleCheckpointComputation.class);
conf.setWorkerContextClass(
SimpleCheckpointVertex.SimpleCheckpointVertexWorkerContext.class);
conf.setMasterComputeClass(
SimpleCheckpointVertex.SimpleCheckpointVertexMasterCompute.class);
conf.setVertexInputFormatClass(SimpleSuperstepVertexInputFormat.class);
conf.setVertexOutputFormatClass(SimpleSuperstepVertexOutputFormat.class);
outputPath = getTempPath("testHashPartitioner");
job = prepareJob("testHashPartitioner", conf, outputPath);
assertTrue(job.run(true));
verifyOutput(hdfs, outputPath);
outputPath = getTempPath("testSuperstepHashPartitioner");
conf = new GiraphConfiguration();
conf.setVertexClass(
SimpleCheckpointVertex.SimpleCheckpointComputation.class);
conf.setWorkerContextClass(
SimpleCheckpointVertex.SimpleCheckpointVertexWorkerContext.class);
conf.setMasterComputeClass(
SimpleCheckpointVertex.SimpleCheckpointVertexMasterCompute.class);
conf.setVertexInputFormatClass(SimpleSuperstepVertexInputFormat.class);
conf.setVertexOutputFormatClass(SimpleSuperstepVertexOutputFormat.class);
job = prepareJob("testSuperstepHashPartitioner", conf, outputPath);
job.getConfiguration().setGraphPartitionerFactoryClass(
SuperstepHashPartitionerFactory.class);
assertTrue(job.run(true));
verifyOutput(hdfs, outputPath);
job = new GiraphJob("testHashRangePartitioner");
setupConfiguration(job);
job.getConfiguration().setVertexClass(
SimpleCheckpointVertex.SimpleCheckpointComputation.class);
job.getConfiguration().setWorkerContextClass(
SimpleCheckpointVertex.SimpleCheckpointVertexWorkerContext.class);
job.getConfiguration().setMasterComputeClass(
SimpleCheckpointVertex.SimpleCheckpointVertexMasterCompute.class);
job.getConfiguration().setVertexInputFormatClass(
SimpleSuperstepVertexInputFormat.class);
job.getConfiguration().setVertexOutputFormatClass(
SimpleSuperstepVertexOutputFormat.class);
job.getConfiguration().setGraphPartitionerFactoryClass(
HashRangePartitionerFactory.class);
outputPath = getTempPath("testHashRangePartitioner");
removeAndSetOutput(job, outputPath);
assertTrue(job.run(true));
verifyOutput(hdfs, outputPath);
outputPath = getTempPath("testReverseIdSuperstepHashPartitioner");
conf = new GiraphConfiguration();
conf.setVertexClass(
SimpleCheckpointVertex.SimpleCheckpointComputation.class);
conf.setWorkerContextClass(
SimpleCheckpointVertex.SimpleCheckpointVertexWorkerContext.class);
conf.setMasterComputeClass(
SimpleCheckpointVertex.SimpleCheckpointVertexMasterCompute.class);
conf.setVertexInputFormatClass(SimpleSuperstepVertexInputFormat.class);
conf.setVertexOutputFormatClass(SimpleSuperstepVertexOutputFormat.class);
job = prepareJob("testReverseIdSuperstepHashPartitioner", conf,
outputPath);
job.getConfiguration().setGraphPartitionerFactoryClass(
SuperstepHashPartitionerFactory.class);
job.getConfiguration().setBoolean(
GeneratedVertexReader.REVERSE_ID_ORDER, true);
assertTrue(job.run(true));
verifyOutput(hdfs, outputPath);
job = new GiraphJob("testSimpleRangePartitioner");
setupConfiguration(job);
job.getConfiguration().setVertexClass(
SimpleCheckpointVertex.SimpleCheckpointComputation.class);
job.getConfiguration().setWorkerContextClass(
SimpleCheckpointVertex.SimpleCheckpointVertexWorkerContext.class);
job.getConfiguration().setMasterComputeClass(
SimpleCheckpointVertex.SimpleCheckpointVertexMasterCompute.class);
job.getConfiguration().setVertexInputFormatClass(
SimpleSuperstepVertexInputFormat.class);
job.getConfiguration().setVertexOutputFormatClass(
SimpleSuperstepVertexOutputFormat.class);
job.getConfiguration().setGraphPartitionerFactoryClass(
SimpleLongRangePartitionerFactory.class);
long readerVertices = job.getConfiguration().getLong(
GeneratedVertexReader.READER_VERTICES, -1);
job.getConfiguration().setLong(
GiraphConstants.PARTITION_VERTEX_KEY_SPACE_SIZE, readerVertices);
outputPath = getTempPath("testSimpleRangePartitioner");
removeAndSetOutput(job, outputPath);
assertTrue(job.run(true));
verifyOutput(hdfs, outputPath);
}