use of org.apache.hama.bsp.ClusterStatus in project whirr by apache.
the class HamaServiceController method waitForGroomServers.
private static void waitForGroomServers(BSPJobClient client) throws IOException {
while (true) {
try {
System.out.print(".");
Thread.sleep(1000);
} catch (InterruptedException e) {
break;
}
ClusterStatus clusterStatus = client.getClusterStatus(true);
int grooms = clusterStatus.getActiveGroomServerStatus().size();
if (grooms > 0) {
LOG.info("{} groomservers reported in. Continuing.", grooms);
break;
}
}
}
use of org.apache.hama.bsp.ClusterStatus in project whirr by apache.
the class HamaServiceTest method test.
@Test(timeout = TestConstants.ITEST_TIMEOUT)
public void test() throws Exception {
HamaConfiguration jobConf = controller.getConfiguration();
jobConf.set("hadoop.rpc.socket.factory.class.default", "org.apache.hadoop.net.StandardSocketFactory");
BSPJob bsp = new BSPJob(jobConf, new BSPJobID());
LOG.info("Job conf: " + bsp.getConf().get("hadoop.rpc.socket.factory.class.default") + ", " + bsp.getJobID().toString());
bsp.setJarByClass(MyEstimator.class);
bsp.setBspClass(MyEstimator.class);
bsp.setInputFormat(NullInputFormat.class);
bsp.setOutputKeyClass(Text.class);
bsp.setOutputValueClass(DoubleWritable.class);
bsp.setOutputFormat(TextOutputFormat.class);
bsp.set("bsp.working.dir", "/tmp");
FileOutputFormat.setOutputPath(bsp, TMP_OUTPUT);
LOG.info("Client configuration start ..");
HamaConfiguration clientConf = controller.getConfiguration();
BSPJobClient jobClient = new BSPJobClient(clientConf);
ClusterStatus cluster = jobClient.getClusterStatus(true);
assertNotNull(cluster);
assertTrue(cluster.getGroomServers() > 0);
assertTrue(cluster.getMaxTasks() > 1);
bsp.setNumBspTask(cluster.getMaxTasks());
LOG.info("Client conf: " + clientConf.get("hadoop.rpc.socket.factory.class.default"));
RunningJob rJob = jobClient.submitJob(bsp);
rJob.waitForCompletion();
LOG.info("finished");
}
Aggregations