From cc683952d2c1730109497aa78dd53629e914d294 Mon Sep 17 00:00:00 2001 From: Sunil G Date: Fri, 23 Feb 2018 16:10:29 +0530 Subject: [PATCH] =?UTF-8?q?YARN-7675.=20[UI2]=20Support=20loading=20pre-2.?= =?UTF-8?q?8=20version=20/scheduler=20REST=20response=20for=20queue=20page?= =?UTF-8?q?.=20Contributed=20by=20Gergely=20Nov=C3=A1k.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../serializers/yarn-queue/capacity-queue.js | 29 +++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) 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 b171c6e588..e838255ba1 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