conf.setVertexClass(AggregatorsTestVertex.class);
conf.setMasterComputeClass(
AggregatorsTestVertex.AggregatorsTestMasterCompute.class);
conf.setVertexInputFormatClass(
SimplePageRankVertex.SimplePageRankVertexInputFormat.class);
GiraphJob job = prepareJob(getCallingMethodName(), conf, outputPath);
GiraphConfiguration configuration = job.getConfiguration();
GiraphConstants.CHECKPOINT_DIRECTORY.set(configuration, checkpointsDir.toString());
GiraphConstants.CLEANUP_CHECKPOINTS_AFTER_SUCCESS.set(configuration, false);
configuration.setCheckpointFrequency(4);
assertTrue(job.run(true));
// Restart the test from superstep 4
System.out.println("testAggregatorsCheckpointing: Restarting from " +
"superstep 4 with checkpoint path = " + checkpointsDir);
outputPath = getTempPath(getCallingMethodName() + "Restarted");
conf = new GiraphConfiguration();
conf.setVertexClass(AggregatorsTestVertex.class);
conf.setMasterComputeClass(
AggregatorsTestVertex.AggregatorsTestMasterCompute.class);
conf.setVertexInputFormatClass(
SimplePageRankVertex.SimplePageRankVertexInputFormat.class);
GiraphJob restartedJob = prepareJob(getCallingMethodName() + "Restarted",
conf, outputPath);
job.getConfiguration().setMasterComputeClass(
SimpleCheckpointVertex.SimpleCheckpointVertexMasterCompute.class);
GiraphConfiguration restartedJobConf = restartedJob.getConfiguration();
GiraphConstants.CHECKPOINT_DIRECTORY.set(restartedJobConf,
checkpointsDir.toString());
restartedJobConf.setLong(GiraphConstants.RESTART_SUPERSTEP, 4);
assertTrue(restartedJob.run(true));
}