Search in sources :

Example 1 with FailedEvaluator

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());
    }
}
Also used : FailedEvaluator(org.apache.reef.driver.evaluator.FailedEvaluator) AllocatedEvaluator(org.apache.reef.driver.evaluator.AllocatedEvaluator) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

AllocatedEvaluator (org.apache.reef.driver.evaluator.AllocatedEvaluator)1 FailedEvaluator (org.apache.reef.driver.evaluator.FailedEvaluator)1 Test (org.junit.Test)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1