Map<ShortestPathVertex, List<ShortestPathVertex>> adjacencyList = null;
if (adjacencyListPath == null)
adjacencyList = ShortestPathsGraphLoader.loadGraph();
BSPJob bsp = new BSPJob(conf, RandBench.class);
// Set the job name
bsp.setJobName("Single Source Shortest Path");
bsp.setBspClass(ShortestPaths.class);
// Set the task size as a number of GroomServer
BSPJobClient jobClient = new BSPJobClient(conf);
ClusterStatus cluster = jobClient.getClusterStatus(true);
StringBuilder sb = new StringBuilder();
for (String peerName : cluster.getActiveGroomNames().values()) {
conf.set(MASTER_TASK, peerName);
sb.append(peerName);
sb.append(";");
}
LOG.info("Master is: " + conf.get(MASTER_TASK));
conf.set(BSP_PEERS, sb.toString());
LOG.info("Starting data partitioning...");
if (adjacencyList == null)
conf = partition(adjacencyListPath, conf, skipPartitioning);
else
conf = partition(adjacencyList, conf);
LOG.info("Finished!");
bsp.setNumBspTask(cluster.getGroomServers());
long startTime = System.currentTimeMillis();
if (bsp.waitForCompletion(true)) {
System.out.println("Job Finished in "
+ (double) (System.currentTimeMillis() - startTime) / 1000.0
+ " seconds");
printOutput(FileSystem.get(conf), conf);
}