use of org.apache.reef.driver.evaluator.FailedEvaluator in project heron by twitter.
the class HeronMasterDriverTest method onNextFailedEvaluatorRestartsContainer.
@Test
public void onNextFailedEvaluatorRestartsContainer() throws Exception {
int numContainers = 3;
AllocatedEvaluator[] mockEvaluators = createApplicationWithContainers(numContainers);
FailedEvaluator mockFailedContainer = mock(FailedEvaluator.class);
when(mockFailedContainer.getId()).thenReturn("e1");
verify(spyDriver, never()).requestContainerForWorker(anyInt(), anyHeronWorker());
spyDriver.new FailedContainerHandler().onNext(mockFailedContainer);
for (int id = 0; id < numContainers; id++) {
if (id == 1) {
verify(spyDriver, times(1)).requestContainerForWorker(eq(id), anyHeronWorker());
assertFalse(spyDriver.lookupByEvaluatorId("e" + id).isPresent());
continue;
}
verify(mockEvaluators[id], never()).close();
assertEquals(Integer.valueOf(id), spyDriver.lookupByEvaluatorId("e" + id).get());
}
}
Aggregations