if (result.getReturnCode() != AbstractJobResult.ReturnCode.SUCCESS) {
System.out.println(result.getDescription());
}
assertEquals(AbstractJobResult.ReturnCode.SUCCESS, result.getReturnCode());
ExecutionGraph eg = jm.getCurrentJobs().get(jobGraph.getJobID());
// wait until everyone has settled in
long deadline = System.currentTimeMillis() + 2000;
while (System.currentTimeMillis() < deadline) {
boolean allrunning = true;
for (ExecutionVertex v : eg.getJobVertex(receiver.getID()).getTaskVertices()) {
if (v.getCurrentExecutionAttempt().getState() != ExecutionState.RUNNING) {
allrunning = false;
break;
}
}
if (allrunning) {
break;
}
Thread.sleep(200);
}
// kill one task manager
TaskManager tm = ((LocalInstanceManager) jm.getInstanceManager()).getTaskManagers()[0];
tm.shutdown();
eg.waitForJobEnd();
// make sure that in any case, the network buffers are all returned
waitForTaskThreadsToBeTerminated();
assertTrue(bp1.isDestroyed() || bp1.numBuffers() == bp1.numAvailableBuffers());
assertTrue(bp2.isDestroyed() || bp2.numBuffers() == bp2.numAvailableBuffers());