From e06ff18ab68d23a0f236df8a0603a42367927f3c Mon Sep 17 00:00:00 2001 From: Sunil G Date: Fri, 10 Mar 2017 16:17:48 +0530 Subject: [PATCH] YARN-6196. Improve Resource Donut chart with better label in Node page of new YARN UI. Contributed by Akhil PB. --- .../webapp/app/helpers/log-files-comma.js | 10 +++++++- .../app/serializers/yarn-node-container.js | 2 +- .../main/webapp/app/serializers/yarn-node.js | 4 ++-- .../webapp/app/serializers/yarn-rm-node.js | 4 ++-- .../main/webapp/app/templates/yarn-node.hbs | 23 ++++++++++++------- .../main/webapp/app/templates/yarn-nodes.hbs | 2 +- .../webapp/app/templates/yarn-nodes/table.hbs | 13 ++++++----- 7 files changed, 37 insertions(+), 21 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/log-files-comma.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/log-files-comma.js index 78dcf257bf..026cd7f991 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/log-files-comma.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/helpers/log-files-comma.js @@ -35,8 +35,16 @@ export default Ember.Helper.helper(function(params,hash) { var containerId = hash.containerId; var html = ''; for (var i = 0; i < logFilesLen; i++) { + var logFileName = ""; + if (logFiles[i]) { + if (typeof logFiles[i] === "object" && logFiles[i].containerLogFiles) { + logFileName = logFiles[i].containerLogFiles; + } else if (typeof logFiles[i] === "string") { + logFileName = logFiles[i]; + } + } html = html + '' + logFiles[i] + + nodeAddr + '/' + containerId + '/' + logFileName + '">' + logFileName + ''; if (i !== logFilesLen - 1) { html = html + ","; diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-node-container.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-node-container.js index 7e78987940..7bcb6553c0 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-node-container.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-node-container.js @@ -30,7 +30,7 @@ export default DS.JSONAPISerializer.extend({ containerId: payload.id, state: payload.state, user: payload.user, - diagnostics: payload.diagnostics, + diagnostics: payload.diagnostics || 'N/A', exitCode: payload.exitCode, totalMemoryNeeded: payload.totalMemoryNeededMB, totalVCoresNeeded: payload.totalVCoresNeeded, diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-node.js index 0d9faec723..10521e62a8 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-node.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-node.js @@ -36,8 +36,8 @@ export default DS.JSONAPISerializer.extend({ pmemCheckEnabled: payload.pmemCheckEnabled, nodeHealthy: payload.nodeHealthy, lastNodeUpdateTime: Converter.timeStampToDate(payload.lastNodeUpdateTime), - healthReport: payload.healthReport, - nmStartupTime: Converter.timeStampToDate(payload.nmStartupTime), + healthReport: payload.healthReport || 'N/A', + nmStartupTime: payload.nmStartupTime? Converter.timeStampToDate(payload.nmStartupTime) : '', nodeManagerBuildVersion: payload.nodeManagerBuildVersion, hadoopBuildVersion: payload.hadoopBuildVersion } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-rm-node.js b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-rm-node.js index ad5062170b..1c6d1be859 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-rm-node.js +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/serializers/yarn-rm-node.js @@ -34,7 +34,7 @@ export default DS.JSONAPISerializer.extend({ nodeHostName: payload.nodeHostName, nodeHTTPAddress: payload.nodeHTTPAddress, lastHealthUpdate: Converter.timeStampToDate(payload.lastHealthUpdate), - healthReport: payload.healthReport, + healthReport: payload.healthReport || 'N/A', numContainers: payload.numContainers, usedMemoryMB: payload.usedMemoryMB, availMemoryMB: payload.availMemoryMB, @@ -57,7 +57,7 @@ export default DS.JSONAPISerializer.extend({ normalizeArrayResponse(store, primaryModelClass, payload/*, id, requestType*/) { // expected response is of the form { data: [ {}, {} ] } var normalizedArrayResponse = {}; - if (payload.nodes) { + if (payload.nodes && payload.nodes.node) { // payload is of the form { "nodes": { "node": [ {},{},{} ] } } normalizedArrayResponse.data = payload.nodes.node.map(singleNode => { return this.internalNormalizeSingleResponse(store, primaryModelClass, diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node.hbs index b7f727af72..1e8549bd87 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node.hbs +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-node.hbs @@ -28,7 +28,7 @@
-
Node Information
+
Node Information: {{model.rmNode.id}}
@@ -63,10 +63,12 @@ - - - - + {{#if model.node.nmStartupTime}} + + + + + {{/if}} @@ -82,22 +84,25 @@
-
+
- Resource - Memory (in MB) + Resource - Memory
{{donut-chart data=model.rmNode.getMemoryDataForDonutChart showLabels=true parentId="mem-donut-chart" ratio=0.6 + type="memory" + colorTargets="good" + colorTargetReverse=true maxHeight=350}}
-
+
Resource - VCores @@ -107,6 +112,8 @@ showLabels=true parentId="vcore-donut-chart" ratio=0.6 + colorTargets="good" + colorTargetReverse=true maxHeight=350}}
diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-nodes.hbs b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-nodes.hbs index 874b3c46f8..795d00efb1 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-nodes.hbs +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/app/templates/yarn-nodes.hbs @@ -29,7 +29,7 @@
Node Health Report {{model.node.healthReport}}
Node Manager Start Time{{model.node.nmStartupTime}}
Node Manager Start Time{{model.node.nmStartupTime}}
Node Manager Version {{model.node.nodeManagerBuildVersion}}