diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 09469e34227..69333daf75a 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -717,6 +717,9 @@ Release 2.8.0 - UNRELEASED YARN-4047. ClientRMService getApplications has high scheduler lock contention. (Jason Lowe via jianhe) + YARN-3987. Send AM container completed msg to NM once AM finishes. + (sandflee via jianhe) + Release 2.7.2 - UNRELEASED INCOMPATIBLE CHANGES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java index 0914022c258..80f5eb06f51 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/rmapp/attempt/RMAppAttemptImpl.java @@ -1658,6 +1658,16 @@ public class RMAppAttemptImpl implements RMAppAttempt, Recoverable { } } + // Ack NM to remove finished AM container, not waiting for + // new appattempt to pull am container complete msg, new appattempt + // may launch fail and leaves too many completed container in NM + private void sendFinishedAMContainerToNM(NodeId nodeId, + ContainerId containerId) { + List containerIdList = new ArrayList(); + containerIdList.add(containerId); + eventHandler.handle(new RMNodeFinishedContainersPulledByAMEvent( + nodeId, containerIdList)); + } // Ack NM to remove finished containers from context. private void sendFinishedContainersToNM() { @@ -1686,9 +1696,13 @@ public class RMAppAttemptImpl implements RMAppAttempt, Recoverable { new ArrayList()); appAttempt.finishedContainersSentToAM.get(nodeId).add( containerFinishedEvent.getContainerStatus()); + if (!appAttempt.getSubmissionContext() .getKeepContainersAcrossApplicationAttempts()) { appAttempt.sendFinishedContainersToNM(); + } else { + appAttempt.sendFinishedAMContainerToNM(nodeId, + containerFinishedEvent.getContainerStatus().getContainerId()); } }