/** * {@link RMAppAttemptState#ALLOCATED} */ @SuppressWarnings("unchecked") private void testAppAttemptAllocatedState(Container amContainer) { assertEquals(RMAppAttemptState.ALLOCATED, applicationAttempt.getAppAttemptState()); assertEquals(amContainer, applicationAttempt.getMasterContainer()); // Check events verify(applicationMasterLauncher).handle(any(AMLauncherEvent.class)); verify(scheduler, times(2)).allocate(any(ApplicationAttemptId.class), any(List.class), any(List.class), any(List.class), any(List.class), any(List.class), any(ContainerUpdates.class)); verify(nmTokenManager).clearNodeSetForAttempt( applicationAttempt.getAppAttemptId()); }
/** * {@link RMAppAttemptState#ALLOCATED} */ @SuppressWarnings("unchecked") private void testAppAttemptAllocatedState(Container amContainer) { assertEquals(RMAppAttemptState.ALLOCATED, applicationAttempt.getAppAttemptState()); assertEquals(amContainer, applicationAttempt.getMasterContainer()); // Check events verify(applicationMasterLauncher).handle(any(AMLauncherEvent.class)); verify(scheduler, times(2)). allocate( any( ApplicationAttemptId.class), any(List.class), any(List.class), any(List.class), any(List.class)); verify(nmTokenManager).clearNodeSetForAttempt( applicationAttempt.getAppAttemptId()); }
appAttempt.scheduler.allocate(appAttempt.applicationAttemptId, Collections.singletonList(appAttempt.amReq), EMPTY_CONTAINER_RELEASE_LIST, null, null);
appAttempt.scheduler.allocate(appAttempt.applicationAttemptId, Collections.singletonList(appAttempt.amReq), EMPTY_CONTAINER_RELEASE_LIST, null, null);
public void testScheduleTransitionReplaceAMContainerRequestWithDefaults() { YarnScheduler mockScheduler = mock(YarnScheduler.class); when(mockScheduler.allocate(any(ApplicationAttemptId.class), any(List.class), any(List.class), any(List.class), any(List.class), any(List.class), any(ContainerUpdates.class)))
YarnScheduler mockScheduler = mock(YarnScheduler.class); when( mockScheduler.allocate(any(ApplicationAttemptId.class), any(List.class), any(List.class), any(List.class), any(List.class))) .thenAnswer(new Answer<Allocation>() {
/** * {@link RMAppAttemptState#SCHEDULED} */ @SuppressWarnings("unchecked") private void testAppAttemptScheduledState() { RMAppAttemptState expectedState; int expectedAllocateCount; if(unmanagedAM) { expectedState = RMAppAttemptState.LAUNCHED; expectedAllocateCount = 0; } else { expectedState = RMAppAttemptState.SCHEDULED; expectedAllocateCount = 1; } assertEquals(expectedState, applicationAttempt.getAppAttemptState()); verify(scheduler, times(expectedAllocateCount)).allocate( any(ApplicationAttemptId.class), any(List.class), eq(null), any(List.class), any(List.class), any(List.class), any(ContainerUpdates.class)); assertEquals(0,applicationAttempt.getJustFinishedContainers().size()); assertNull(applicationAttempt.getMasterContainer()); assertEquals(0.0, (double)applicationAttempt.getProgress(), 0.0001); assertEquals(0, application.getRanNodes().size()); assertNull(applicationAttempt.getFinalApplicationStatus()); }
/** * {@link RMAppAttemptState#SCHEDULED} */ @SuppressWarnings("unchecked") private void testAppAttemptScheduledState() { RMAppAttemptState expectedState; int expectedAllocateCount; if(unmanagedAM) { expectedState = RMAppAttemptState.LAUNCHED; expectedAllocateCount = 0; } else { expectedState = RMAppAttemptState.SCHEDULED; expectedAllocateCount = 1; } assertEquals(expectedState, applicationAttempt.getAppAttemptState()); verify(scheduler, times(expectedAllocateCount)). allocate(any(ApplicationAttemptId.class), any(List.class), any(List.class), any(List.class), any(List.class)); assertEquals(0,applicationAttempt.getJustFinishedContainers().size()); assertNull(applicationAttempt.getMasterContainer()); assertEquals(0.0, (double)applicationAttempt.getProgress(), 0.0001); assertEquals(0, application.getRanNodes().size()); assertNull(applicationAttempt.getFinalApplicationStatus()); }
appAttempt.scheduler.allocate(appAttempt.applicationAttemptId, EMPTY_CONTAINER_REQUEST_LIST, EMPTY_CONTAINER_RELEASE_LIST, null, null);
appAttempt.scheduler.allocate(appAttempt.applicationAttemptId, EMPTY_CONTAINER_REQUEST_LIST, null, EMPTY_CONTAINER_RELEASE_LIST, null, null, new ContainerUpdates());
appAttempt.scheduler.allocate(appAttempt.applicationAttemptId, EMPTY_CONTAINER_REQUEST_LIST, EMPTY_CONTAINER_RELEASE_LIST, null, null);
when(allocation.getContainers()). thenReturn(Collections.singletonList(container)); when(scheduler.allocate(any(ApplicationAttemptId.class), any(List.class), any(List.class), any(List.class), any(List.class), any(List.class), any(ContainerUpdates.class))).
thenReturn(Collections.singletonList(container)); when( scheduler.allocate( any(ApplicationAttemptId.class), any(List.class),
appAttempt.scheduler.allocate( appAttempt.applicationAttemptId, appAttempt.amReqs, null, EMPTY_CONTAINER_RELEASE_LIST,
when(allocation.getContainers()). thenReturn(Collections.singletonList(amContainer)); when(scheduler.allocate(any(ApplicationAttemptId.class), any(List.class), any(List.class), any(List.class), any(List.class), any(List.class), any(ContainerUpdates.class)))
when(allocation.getContainers()). thenReturn(Collections.singletonList(amContainer)); when(scheduler.allocate(any(ApplicationAttemptId.class), any(List.class), any(List.class), any(List.class), any(List.class))).thenReturn(allocation); RMContainer rmContainer = mock(RMContainerImpl.class);
} else { try { allocation = getScheduler().allocate(appAttemptId, ask, request.getSchedulingRequests(), release, blacklistAdditions, blacklistRemovals, containerUpdateRequests);
this.rScheduler.allocate(appAttemptId, ask, release, blacklistAdditions, blacklistRemovals);
this.rScheduler.allocate(appAttemptId, ask, release, blacklistAdditions, blacklistRemovals);