SimpleCheckpointVertex.SimpleCheckpointVertexWorkerContext.class);
conf.setMasterComputeClass(
SimpleCheckpointVertex.SimpleCheckpointVertexMasterCompute.class);
conf.setVertexInputFormatClass(SimpleSuperstepVertexInputFormat.class);
conf.setVertexOutputFormatClass(SimpleSuperstepVertexOutputFormat.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(2);
assertTrue(job.run(true));
long idSum = 0;
if (!runningInDistributedMode()) {
FileStatus fileStatus = getSinglePartFileStatus(job.getConfiguration(),
outputPath);
idSum = SimpleCheckpointVertex.SimpleCheckpointVertexWorkerContext
.getFinalSum();
System.out.println("testBspCheckpoint: idSum = " + idSum +
" fileLen = " + fileStatus.getLen());
}
// Restart the test from superstep 2
System.out.println("testBspCheckpoint: Restarting from superstep 2" +
" with checkpoint path = " + checkpointsDir);
outputPath = getTempPath(getCallingMethodName() + "Restarted");
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);
GiraphJob restartedJob = prepareJob(getCallingMethodName() + "Restarted",
conf, outputPath);
configuration.setMasterComputeClass(
SimpleCheckpointVertex.SimpleCheckpointVertexMasterCompute.class);
GiraphConstants.CHECKPOINT_DIRECTORY.set(restartedJob.getConfiguration(),
checkpointsDir.toString());
assertTrue(restartedJob.run(true));
if (!runningInDistributedMode()) {
long idSumRestarted =
SimpleCheckpointVertex.SimpleCheckpointVertexWorkerContext
.getFinalSum();
System.out.println("testBspCheckpoint: idSumRestarted = " +