final JobGraph jobGraph = new JobGraph("Pointwise Job", sender, receiver);
jobGraph.setNumberOfExecutionRetries(1);
jm = startJobManager(NUM_TASKS);
final GlobalBufferPool bp = ((LocalInstanceManager) jm.getInstanceManager())
.getTaskManagers()[0].getChannelManager().getGlobalBufferPool();
JobSubmissionResult result = jm.submitJob(jobGraph);
if (result.getReturnCode() != AbstractJobResult.ReturnCode.SUCCESS) {
System.out.println(result.getDescription());
}
assertEquals(AbstractJobResult.ReturnCode.SUCCESS, result.getReturnCode());
// monitor the execution
ExecutionGraph eg = jm.getCurrentJobs().get(jobGraph.getJobID());
if (eg != null) {
eg.waitForJobEnd();
assertEquals(JobStatus.FINISHED, eg.getState());
}
else {
// already done, that was fast;
}
// make sure that in any case, the network buffers are all returned
waitForTaskThreadsToBeTerminated();
assertEquals(bp.numBuffers(), bp.numAvailableBuffers());
}
catch (Exception e) {
e.printStackTrace();
fail(e.getMessage());
}