hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rohithsharm...@apache.org
Subject hadoop git commit: YARN-6082. Invalid REST api response for getApps since queueUsagePercentage is coming as INF. Contributed by Sunil G.
Date Tue, 24 Jan 2017 05:32:07 GMT
Repository: hadoop
Updated Branches:
  refs/heads/branch-2 94b326f2c -> 26c4cfb65


YARN-6082. Invalid REST api response for getApps since queueUsagePercentage is coming as INF.
Contributed by Sunil G.

(cherry picked from commit 0101267d9d801eab4cb3b4df289c402ecb591685)


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

Branch: refs/heads/branch-2
Commit: 26c4cfb653c587ac1f9dd24f4ea3c279a46c745b
Parents: 94b326f
Author: Rohith Sharma K S <rohithsharmaks@apache.org>
Authored: Tue Jan 24 10:59:55 2017 +0530
Committer: Rohith Sharma K S <rohithsharmaks@apache.org>
Committed: Tue Jan 24 11:01:52 2017 +0530

----------------------------------------------------------------------
 .../scheduler/SchedulerApplicationAttempt.java          |  9 ++++++---
 .../scheduler/TestSchedulerApplicationAttempt.java      | 12 ++++++++++++
 2 files changed, 18 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/26c4cfb6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerApplicationAttempt.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/SchedulerApplicationAttempt.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerApplicationAttempt.java
index aab6811..5647ebd 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerApplicationAttempt.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/SchedulerApplicationAttempt.java
@@ -901,9 +901,12 @@ public class SchedulerApplicationAttempt implements SchedulableEntity
{
       float queueUsagePerc = 0.0f;
       float clusterUsagePerc = 0.0f;
       if (!calc.isInvalidDivisor(cluster)) {
-        queueUsagePerc = calc.divide(cluster, usedResourceClone, Resources
-            .multiply(cluster, queue.getQueueInfo(false, false).getCapacity()))
-            * 100;
+        float queueCapacityPerc = queue.getQueueInfo(false, false)
+            .getCapacity();
+        if (queueCapacityPerc != 0) {
+          queueUsagePerc = calc.divide(cluster, usedResourceClone,
+              Resources.multiply(cluster, queueCapacityPerc)) * 100;
+        }
         clusterUsagePerc = calc.divide(cluster, usedResourceClone, cluster)
             * 100;
       }

http://git-wip-us.apache.org/repos/asf/hadoop/blob/26c4cfb6/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/TestSchedulerApplicationAttempt.java
----------------------------------------------------------------------
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/TestSchedulerApplicationAttempt.java
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/TestSchedulerApplicationAttempt.java
index ff5dc02..0a3075e 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/TestSchedulerApplicationAttempt.java
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/TestSchedulerApplicationAttempt.java
@@ -228,6 +228,18 @@ public class TestSchedulerApplicationAttempt {
         0.01f);
     assertEquals(60.0f,
         app.getResourceUsageReport().getClusterUsagePercentage(), 0.01f);
+
+    queue = createQueue("test3", null, 0.0f);
+    app = new SchedulerApplicationAttempt(appAttId, user, queue,
+        queue.getActiveUsersManager(), rmContext);
+
+    // Resource request
+    app.attemptResourceUsage.incUsed(requestedResource);
+
+    assertEquals(0.0f, app.getResourceUsageReport().getQueueUsagePercentage(),
+        0.01f);
+    assertEquals(15.0f,
+        app.getResourceUsageReport().getClusterUsagePercentage(), 0.01f);
   }
 
   @Test


---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org


Mime
View raw message