From c2d6fa36560d122ff24dd7db84f68f4ba3fb8123 Mon Sep 17 00:00:00 2001 From: Rohith Sharma K S Date: Mon, 8 Jan 2018 10:39:31 +0530 Subject: [PATCH] YARN-7699. queueUsagePercentage is coming as INF for getApp REST api call. Contributed by Sunil G. --- .../scheduler/common/fica/FiCaSchedulerApp.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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/common/fica/FiCaSchedulerApp.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/common/fica/FiCaSchedulerApp.java index 776a7e98af..d82a258e42 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/common/fica/FiCaSchedulerApp.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/scheduler/common/fica/FiCaSchedulerApp.java @@ -1011,11 +1011,14 @@ public ApplicationResourceUsageReport getResourceUsageReport() { getAppAMNodePartitionName(), cluster); ResourceCalculator calc = rmContext.getScheduler().getResourceCalculator(); + float queueUsagePerc = 0.0f; if (!calc.isInvalidDivisor(totalPartitionRes)) { Resource effCap = ((AbstractCSQueue) getQueue()) .getEffectiveCapacity(getAppAMNodePartitionName()); - float queueUsagePerc = calc.divide(totalPartitionRes, - report.getUsedResources(), effCap) * 100; + if (!effCap.equals(Resources.none())) { + queueUsagePerc = calc.divide(totalPartitionRes, + report.getUsedResources(), effCap) * 100; + } report.setQueueUsagePercentage(queueUsagePerc); } return report;