Browse Source

YARN-541. getAllocatedContainers() is not returning all the allocated containers (bikas)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1502906 13f79535-47bb-0310-9956-ffa450edef68
Bikas Saha 12 years ago
parent
commit
2adee63426

+ 3 - 0
hadoop-yarn-project/CHANGES.txt

@@ -683,6 +683,9 @@ Release 2.1.0-beta - 2013-07-02
     from application masters that have not registered (Mayank Bansal &
     Abhishek Kapoor via bikas)
 
+    YARN-541. getAllocatedContainers() is not returning all the allocated
+    containers (bikas)
+
   BREAKDOWN OF HADOOP-8562 SUBTASKS AND RELATED JIRAS
 
     YARN-158. Yarn creating package-info.java must not depend on sh.

+ 8 - 1
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/impl/AMRMClientImpl.java

@@ -230,7 +230,14 @@ public class AMRMClientImpl<T extends ContainerRequest> extends AMRMClient<T> {
     
     try {
       synchronized (this) {
-        askList = new ArrayList<ResourceRequest>(ask);
+        askList = new ArrayList<ResourceRequest>(ask.size());
+        for(ResourceRequest r : ask) {
+          // create a copy of ResourceRequest as we might change it while the 
+          // RPC layer is using it to send info across
+          askList.add(ResourceRequest.newInstance(r.getPriority(),
+              r.getResourceName(), r.getCapability(), r.getNumContainers(),
+              r.getRelaxLocality()));
+        }
         releaseList = new ArrayList<ContainerId>(release);
         // optimistically clear this collection assuming no RPC failure
         ask.clear();