Repository: hadoop
Updated Branches:
  refs/heads/branch-3.1 b8942cb3b -> c15218727


YARN-7675. [UI2] Support loading pre-2.8 version /scheduler REST response for 
queue page. Contributed by Gergely Novák.

(cherry picked from commit cc683952d2c1730109497aa78dd53629e914d294)


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

Branch: refs/heads/branch-3.1
Commit: c1521872753154a347843a46931aa0a183877c66
Parents: b8942cb
Author: Sunil G <sun...@apache.org>
Authored: Fri Feb 23 16:10:29 2018 +0530
Committer: Sunil G <sun...@apache.org>
Committed: Fri Feb 23 16:11:20 2018 +0530

----------------------------------------------------------------------
 .../serializers/yarn-queue/capacity-queue.js    | 29 ++++++++++++++++----
 1 file changed, 24 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/c1521872/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-queue/capacity-queue.js
----------------------------------------------------------------------
diff --git 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-queue/capacity-queue.js
 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-queue/capacity-queue.js
index b171c6e..e838255 100644
--- 
a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-queue/capacity-queue.js
+++ 
b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-queue/capacity-queue.js
@@ -54,6 +54,28 @@ export default DS.JSONAPISerializer.extend({
         });
       }
 
+      var partitions = [];
+      var partitionMap = {};
+      if ("capacities" in payload) {
+        partitions = payload.capacities.queueCapacitiesByPartition.map(
+          cap => cap.partitionName || PARTITION_LABEL);
+        partitionMap = 
payload.capacities.queueCapacitiesByPartition.reduce((init, cap) => {
+          init[cap.partitionName || PARTITION_LABEL] = cap;
+          return init;
+        }, {});
+      } else {
+        partitions = [PARTITION_LABEL];
+        partitionMap[PARTITION_LABEL] = {
+          partitionName: "",
+          capacity: payload.capacity,
+          maxCapacity: payload.maxCapacity,
+          usedCapacity: payload.usedCapacity,
+          absoluteCapacity: 'absoluteCapacity' in payload ? 
payload.absoluteCapacity : payload.capacity,
+          absoluteMaxCapacity: 'absoluteMaxCapacity' in payload ? 
payload.absoluteMaxCapacity : payload.maxCapacity,
+          absoluteUsedCapacity: 'absoluteUsedCapacity' in payload ? 
payload.absoluteUsedCapacity : payload.usedCapacity,
+        };
+      }
+
       var fixedPayload = {
         id: id,
         type: primaryModelClass.modelName, // yarn-queue
@@ -74,11 +96,8 @@ export default DS.JSONAPISerializer.extend({
           numPendingApplications: payload.numPendingApplications,
           numActiveApplications: payload.numActiveApplications,
           resources: payload.resources,
-          partitions: payload.capacities.queueCapacitiesByPartition.map(cap => 
cap.partitionName || PARTITION_LABEL),
-          partitionMap: 
payload.capacities.queueCapacitiesByPartition.reduce((init, cap) => {
-            init[cap.partitionName || PARTITION_LABEL] = cap;
-            return init;
-          }, {}),
+          partitions: partitions,
+          partitionMap: partitionMap,
           type: "capacity",
         },
         // Relationships


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

Reply via email to