try {
long startMillis = System.currentTimeMillis();
long initializeMillis = 0;
long endMillis = 0;
bspServiceMaster.setup();
SuperstepState superstepState = SuperstepState.INITIAL;
if (bspServiceMaster.becomeMaster()) {
// First call to checkWorkers waits for all pending resources.
// If these resources are still available at subsequent calls it just
// reads zookeeper for the list of healthy workers.
bspServiceMaster.checkWorkers();
initializeMillis = System.currentTimeMillis();
GiraphTimers.getInstance().getInitializeMs().increment(
initializeMillis - startMillis);
// Attempt to create InputSplits if necessary. Bail out if that fails.
if (bspServiceMaster.getRestartedSuperstep() !=
BspService.UNSET_SUPERSTEP ||
(bspServiceMaster.createMappingInputSplits() != -1 &&
bspServiceMaster.createVertexInputSplits() != -1 &&
bspServiceMaster.createEdgeInputSplits() != -1)) {
long setupMillis = System.currentTimeMillis() - initializeMillis;
GiraphTimers.getInstance().getSetupMs().increment(setupMillis);
setupSecs = setupMillis / 1000.0d;
while (!superstepState.isExecutionComplete()) {
long startSuperstepMillis = System.currentTimeMillis();
long cachedSuperstep = bspServiceMaster.getSuperstep();
GiraphMetrics.get().resetSuperstepMetrics(cachedSuperstep);
Class<? extends Computation> computationClass =
bspServiceMaster.getMasterCompute().getComputation();