YARN-9396. Fixed duplicated RM Container created event to ATS.

Contributed by Prabhu Joseph
This commit is contained in:
Eric Yang 2019-04-04 13:01:56 -04:00
parent c90736350b
commit 8d150067e2
2 changed files with 7 additions and 4 deletions

View File

@ -608,7 +608,10 @@ public void transition(RMContainerImpl container, RMContainerEvent event) {
container.eventHandler.handle(new RMAppRunningOnNodeEvent(container container.eventHandler.handle(new RMAppRunningOnNodeEvent(container
.getApplicationAttemptId().getApplicationId(), container.nodeId)); .getApplicationAttemptId().getApplicationId(), container.nodeId));
publishNonAMContainerEventstoATS(container); // Opportunistic containers move directly from NEW to ACQUIRED
if (container.getState() == RMContainerState.NEW) {
publishNonAMContainerEventstoATS(container);
}
} }
} }

View File

@ -150,7 +150,7 @@ public void testReleaseWhileRunning() {
RMContainerEventType.LAUNCHED)); RMContainerEventType.LAUNCHED));
drainDispatcher.await(); drainDispatcher.await();
assertEquals(RMContainerState.RUNNING, rmContainer.getState()); assertEquals(RMContainerState.RUNNING, rmContainer.getState());
verify(publisher, times(2)).containerCreated(any(RMContainer.class), verify(publisher, times(1)).containerCreated(any(RMContainer.class),
anyLong()); anyLong());
assertEquals("http://host:3465/node/containerlogs/container_1_0001_01_000001/user", assertEquals("http://host:3465/node/containerlogs/container_1_0001_01_000001/user",
rmContainer.getLogURL()); rmContainer.getLogURL());
@ -253,7 +253,7 @@ public void testExpireWhileRunning() {
RMContainerEventType.ACQUIRED)); RMContainerEventType.ACQUIRED));
drainDispatcher.await(); drainDispatcher.await();
assertEquals(RMContainerState.ACQUIRED, rmContainer.getState()); assertEquals(RMContainerState.ACQUIRED, rmContainer.getState());
verify(publisher, times(2)).containerCreated(any(RMContainer.class), verify(publisher, times(1)).containerCreated(any(RMContainer.class),
anyLong()); anyLong());
rmContainer.handle(new RMContainerEvent(containerId, rmContainer.handle(new RMContainerEvent(containerId,
@ -345,7 +345,7 @@ public void testStoreAllContainerMetrics() throws Exception {
// RMContainer should be publishing system metrics for all containers. // RMContainer should be publishing system metrics for all containers.
// Since there is 1 AM container and 1 non-AM container, there should be 2 // Since there is 1 AM container and 1 non-AM container, there should be 2
// container created events and 2 container finished events. // container created events and 2 container finished events.
verify(publisher, times(4)).containerCreated(any(RMContainer.class), verify(publisher, times(2)).containerCreated(any(RMContainer.class),
anyLong()); anyLong());
verify(publisher, times(2)).containerFinished(any(RMContainer.class), anyLong()); verify(publisher, times(2)).containerFinished(any(RMContainer.class), anyLong());
} }