diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/ApplicationMaster.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/ApplicationMaster.java index df9f34b..4544a67 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/ApplicationMaster.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-applications-distributedshell/src/main/java/org/apache/hadoop/yarn/applications/distributedshell/ApplicationMaster.java @@ -183,7 +183,9 @@ // Handle to communicate with the Resource Manager @SuppressWarnings("rawtypes") - private AMRMClientAsync amRMClient; + private AMRMClientAsync amRMClient; + + private ContainerRequest containerRequest; // In both secure and non-secure modes, this points to the job-submitter. private UserGroupInformation appSubmitterUgi; @@ -610,6 +612,7 @@ public void run() throws YarnException, IOException { for (int i = 0; i < numTotalContainersToRequest; ++i) { ContainerRequest containerAsk = setupContainerAskForRM(); amRMClient.addContainerRequest(containerAsk); + containerRequest = containerAsk; } numRequestedContainers.set(numTotalContainers); try { @@ -775,6 +778,7 @@ public void onContainersAllocated(List allocatedContainers) { // as all containers may not be allocated at one go. launchThreads.add(launchThread); launchThread.start(); + ApplicationMaster.this.amRMClient.removeContainerRequest(containerRequest); } }