Browse Source

AMBARI-2921. YARN Queue Memory graph not showing all queues. (srimanth)

Srimanth Gunturi 11 năm trước cách đây
mục cha
commit
d44c1c2ba9

+ 1 - 1
ambari-web/app/messages.js

@@ -964,7 +964,7 @@ Em.I18n.translations = {
   'services.service.info.metrics.yarn.queueMemoryResource':'Queue Memory',
   'services.service.info.metrics.yarn.queueMemoryResource.displayNames.allocated':'Allocated ({0})',
   'services.service.info.metrics.yarn.queueMemoryResource.displayNames.available':'Available ({0})',
-  'services.service.info.metrics.yarn.queueMemoryResource.displayName':'Queue Memory ({0})',
+  'services.service.info.metrics.yarn.queueMemoryResource.displayName':'Queue: {0}',
 
   'services.service.info.menu.summary':'Summary',
   'services.service.info.menu.configs':'Configs',

+ 11 - 4
ambari-web/app/models/service/yarn.js

@@ -53,13 +53,16 @@ App.YARNService = App.Service.extend({
     var queue = JSON.parse(this.get('queue'));
     return objectUtils.recursiveKeysCount(queue);
   }.property('queue'),
+  allQueueNames: [],
+  childQueueNames: [],
   /** 
    * Provides a flat array of queue names.
    * Example: root, root/default
    */
   queueNames: function () {
     var queueString = this.get('queue');
-    var queueNames = [];
+    var allQueueNames = [];
+    var childQueueNames = [];
     if (queueString != null) {
       var queues = JSON.parse(queueString);
       var addQueues = function (queuesObj, path){
@@ -70,14 +73,18 @@ App.YARNService = App.Service.extend({
             names.push(qFN);
             var subNames = addQueues(queuesObj[subQueue], qFN);
             names = names.concat(subNames);
+            if (!subNames || subNames.length < 1) {
+              childQueueNames.push(qFN);
+            }
           }
         }
         return names;
       }
-      queueNames = addQueues(queues, '');
+      allQueueNames = addQueues(queues, '');
     }
-    return queueNames;
-  }.property('queue'),
+    this.set('allQueueNames', allQueueNames);
+    this.set('childQueueNames', childQueueNames);
+  }.observes('queue'),
 });
 
 App.YARNService.FIXTURES = [];

+ 6 - 6
ambari-web/app/views/main/service/info/metrics/yarn/qmr.js

@@ -39,7 +39,7 @@ App.ChartServiceMetricsYARN_QMR = App.ChartLinearTimeView.extend({
     var svc = App.YARNService.find().objectAt(0);
     var queueNames = [];
     if (svc != null) {
-      queueNames = svc.get('queueNames');
+      queueNames = svc.get('childQueueNames');
     }
     data.queueNames = queueNames;
     return data;
@@ -52,11 +52,11 @@ App.ChartServiceMetricsYARN_QMR = App.ChartLinearTimeView.extend({
     var svc = App.YARNService.find().objectAt(0);
     var queueNames = [];
     if (svc != null) {
-      queueNames = svc.get('queueNames');
+      queueNames = svc.get('childQueueNames');
     }
     if (jsonData && jsonData.metrics && jsonData.metrics.yarn.Queue) {
       queueNames.forEach(function (qName) {
-        var qPath = qName.replace('/', '.');
+        var qPath = qName.replace(/\//g, '.')
         var displayName;
         var allocatedData = objUtils.getProperty(jsonData.metrics.yarn.Queue, qPath + '.AllocatedMB');
         var availableData = objUtils.getProperty(jsonData.metrics.yarn.Queue, qPath + '.AvailableMB');
@@ -65,10 +65,10 @@ App.ChartServiceMetricsYARN_QMR = App.ChartLinearTimeView.extend({
         if (allocatedData != null && availableData != null) {
           if (typeof allocatedData == "number" && typeof availableData == "number") {
             seriesData = (allocatedData * 100) / availableData;
-          } else if (allocatedData.length == availableData.length) {
+          } else if (allocatedData.length > 0 && availableData.length > 0) {
             seriesData = [];
-            for ( var c = 0; c < allocated.length; c++) {
-              seriesData.push([ (allocatedData[c][0] * 100) / availableData[c][0] ], allocatedData[c][1]);
+            for ( var c = 0; c < Math.min(availableData.length, allocatedData.length); c++) {
+              seriesData.push([ (allocatedData[c][0] * 100) / availableData[c][0], allocatedData[c][1] ]);
             }
           } else {
             console.log("Skipping data series for Queue " + qName);