YARN-3432. Cluster metrics have wrong Total Memory when there is reserved memory on CS. (Brahma Reddy Battula via curino)
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/892a8348 Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/892a8348 Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/892a8348 Branch: refs/heads/HDFS-9806 Commit: 892a8348fceb42069ea9877251c413fe33415e16 Parents: 79ae78d Author: Carlo Curino <cur...@apache.org> Authored: Thu Oct 27 15:12:10 2016 -0700 Committer: Carlo Curino <cur...@apache.org> Committed: Thu Oct 27 15:15:49 2016 -0700 ---------------------------------------------------------------------- .../resourcemanager/webapp/dao/ClusterMetricsInfo.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/892a8348/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/ClusterMetricsInfo.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/webapp/dao/ClusterMetricsInfo.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/ClusterMetricsInfo.java index 1789e09..f083b05 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/ClusterMetricsInfo.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/webapp/dao/ClusterMetricsInfo.java @@ -25,6 +25,7 @@ import org.apache.hadoop.yarn.server.resourcemanager.ClusterMetrics; import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.QueueMetrics; import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler; +import org.apache.hadoop.yarn.server.resourcemanager.scheduler.capacity.CapacityScheduler; @XmlRootElement(name = "clusterMetrics") @XmlAccessorType(XmlAccessType.FIELD) @@ -87,8 +88,14 @@ public class ClusterMetricsInfo { this.containersPending = metrics.getPendingContainers(); this.containersReserved = metrics.getReservedContainers(); - this.totalMB = availableMB + allocatedMB; - this.totalVirtualCores = availableVirtualCores + allocatedVirtualCores; + if (rs instanceof CapacityScheduler) { + this.totalMB = availableMB + allocatedMB + reservedMB; + this.totalVirtualCores = availableVirtualCores + allocatedVirtualCores + + containersReserved; + } else { + this.totalMB = availableMB + allocatedMB; + this.totalVirtualCores = availableVirtualCores + allocatedVirtualCores; + } this.activeNodes = clusterMetrics.getNumActiveNMs(); this.lostNodes = clusterMetrics.getNumLostNMs(); this.unhealthyNodes = clusterMetrics.getUnhealthyNMs(); --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org