Repository: hadoop
Updated Branches:
  refs/heads/branch-2.7 086ee0adf -> bc3e188e1


YARN-6152. Used queue percentage not accurate in UI for 2.7 and below when 
using DominantResourceCalculator. Contributed by Jonathan Hung


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/bc3e188e
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/bc3e188e
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/bc3e188e

Branch: refs/heads/branch-2.7
Commit: bc3e188e11ad3e99ffdfa43335c5b0cd80c031a6
Parents: 086ee0a
Author: Eric Payne <[email protected]>
Authored: Tue Feb 7 11:33:28 2017 -0600
Committer: Eric Payne <[email protected]>
Committed: Tue Feb 7 11:33:28 2017 -0600

----------------------------------------------------------------------
 .../scheduler/capacity/AbstractCSQueue.java     | 21 ++++++++++----------
 1 file changed, 11 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/bc3e188e/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/AbstractCSQueue.java
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/AbstractCSQueue.java
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/AbstractCSQueue.java
index 3ad4b7f..544403b 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/AbstractCSQueue.java
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/capacity/AbstractCSQueue.java
@@ -545,16 +545,17 @@ public abstract class AbstractCSQueue implements CSQueue {
    * @return used resources by this queue for specified label
    */
   public final synchronized float getUsedCapacity(final String nodeLabel) {
+    Resource totalPartitionResource =
+        labelManager.getResourceByLabel(nodeLabel, this.clusterResource);
     Resource availableToQueue =
-        Resources.multiply(
-            labelManager.getResourceByLabel(nodeLabel, this.clusterResource),
+        Resources.multiply(totalPartitionResource,
             queueCapacities.getAbsoluteCapacity(nodeLabel));
-    if (!Resources.greaterThan(resourceCalculator, this.clusterResource,
+    if (!Resources.greaterThan(resourceCalculator, totalPartitionResource,
          availableToQueue, Resources.none())) {
       return 0.0f;
     }
     return
-        Resources.divide(resourceCalculator, this.clusterResource,
+        Resources.divide(resourceCalculator, totalPartitionResource,
             queueUsage.getUsed(nodeLabel), availableToQueue);
   }
 
@@ -564,13 +565,13 @@ public abstract class AbstractCSQueue implements CSQueue {
    * @return absolute used resources by this queue for specified label
    */
   public final synchronized float getAbsoluteUsedCapacity(final String 
nodeLabel) {
-    Resource labeledResources =
-               labelManager.getResourceByLabel(nodeLabel, 
this.clusterResource);
-    if (!Resources.greaterThan(resourceCalculator, this.clusterResource,
-        labeledResources, Resources.none())) {
+    Resource totalPartitionResource =
+        labelManager.getResourceByLabel(nodeLabel, this.clusterResource);
+    if (!Resources.greaterThan(resourceCalculator, totalPartitionResource,
+        totalPartitionResource, Resources.none())) {
       return 0.0f;
     }
-    return Resources.divide(resourceCalculator, this.clusterResource,
-        queueUsage.getUsed(nodeLabel), labeledResources);
+    return Resources.divide(resourceCalculator, totalPartitionResource,
+        queueUsage.getUsed(nodeLabel), totalPartitionResource);
   }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to