You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by su...@apache.org on 2019/05/10 08:57:32 UTC

[hadoop] branch trunk updated: YARN-9504. [UI2] Fair scheduler queue view page does not show actual capacity. Contributed by Zoltan Siegl.

This is an automated email from the ASF dual-hosted git repository.

sunilg pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 64c7f36  YARN-9504. [UI2] Fair scheduler queue view page does not show actual capacity. Contributed by Zoltan Siegl.
64c7f36 is described below

commit 64c7f36ab12faba26a2ecf1e6a0cab7eb2bcffdd
Author: Sunil G <su...@apache.org>
AuthorDate: Fri May 10 14:26:06 2019 +0530

    YARN-9504. [UI2] Fair scheduler queue view page does not show actual capacity. Contributed by Zoltan Siegl.
---
 .../main/webapp/app/components/tree-selector.js    | 43 ++++++++++++++++++++--
 1 file changed, 39 insertions(+), 4 deletions(-)

diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/tree-selector.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/tree-selector.js
index 5168c0e..9becfc1 100644
--- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/tree-selector.js
+++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/components/tree-selector.js
@@ -192,7 +192,8 @@ export default Ember.Component.extend({
       .style(
         "fill",
         function(d) {
-          const usedCapacity = getUsedCapacity(d.queueData.get("partitionMap"), this.filteredPartition);
+          const usedCapacity = getUsedCapacity(d.queueData, this.filteredPartition);
+
           if (usedCapacity <= 60.0) {
             return "#60cea5";
           } else if (usedCapacity <= 100.0) {
@@ -216,7 +217,8 @@ export default Ember.Component.extend({
       })
       .text(
         function(d) {
-          const usedCapacity = getUsedCapacity(d.queueData.get("partitionMap"), this.filteredPartition);
+          const usedCapacity = getUsedCapacity(d.queueData, this.filteredPartition);
+
           if (usedCapacity >= 100.0) {
             return usedCapacity.toFixed(0) + "%";
           } else {
@@ -372,6 +374,39 @@ export default Ember.Component.extend({
 });
 
 
-const getUsedCapacity = (partitionMap, filter=PARTITION_LABEL) => {
-  return partitionMap[filter].absoluteUsedCapacity;
+const getUsedCapacity = (queueData, filter=PARTITION_LABEL) => {
+
+  const type = queueData.get("type");
+  var result;
+
+  switch (type) {
+    case "capacity":
+      const partitionMap = queueData.get("partitionMap");
+      if (null == partitionMap || null == partitionMap[filter] || null == partitionMap[filter].absoluteUsedCapacity) {
+        result = 0.0;
+      } else {
+        result = partitionMap[filter].absoluteUsedCapacity;
+      }
+      break;
+
+    case "fair":
+       if (null == queueData.get("fairResources") || null == queueData.get("fairResources").memory || null == queueData.get("usedResources") || null == queueData.get("usedResources").memory || 0 == queueData.get("fairResources").memory) {
+         result = 0.0;
+       } else {
+         result = queueData.get("usedResources").memory / queueData.get("fairResources").memory * 100;
+       }
+      break;
+
+    case "fifo":
+       if (null == queueData.get("usedCapacity") || (null == queueData.get("capacity")) || (queueData.get("capacity") == 0)) {
+         result = 0.0;
+       } else {
+         result = queueData.get("usedCapacity") / queueData.get("capacity") * 100;
+       }
+       break;
+
+    default:
+      result = 0.0;
+  }
+  return result;
 };
\ No newline at end of file


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