Forráskód Böngészése

YARN-9099. GpuResourceAllocator#getReleasingGpus calculates number of GPUs in a wrong way. Contributed by Szilard Nemeth.

(cherry picked from commit 71c49fa60faad2504b0411979a6e46e595b97a85)
Sunil G 6 éve
szülő
commit
0e7060a1d5

+ 1 - 4
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-nodemanager/src/main/java/org/apache/hadoop/yarn/server/nodemanager/containermanager/linux/resources/gpu/GpuResourceAllocator.java

@@ -258,10 +258,7 @@ public class GpuResourceAllocator {
 
 
   private synchronized long getReleasingGpus() {
   private synchronized long getReleasingGpus() {
     long releasingGpus = 0;
     long releasingGpus = 0;
-    Iterator<Map.Entry<GpuDevice, ContainerId>> iter = usedDevices.entrySet()
-        .iterator();
-    while (iter.hasNext()) {
-      ContainerId containerId = iter.next().getValue();
+    for (ContainerId containerId : ImmutableSet.copyOf(usedDevices.values())) {
       Container container;
       Container container;
       if ((container = nmContext.getContainers().get(containerId)) != null) {
       if ((container = nmContext.getContainers().get(containerId)) != null) {
         if (container.isContainerInFinalStates()) {
         if (container.isContainerInFinalStates()) {