Explorar el Código

AMBARI-6217 Ambari-web's YARN Metric "Queue Memory Used" goes over 100%. (ababiichuk)

aBabiichuk hace 11 años
padre
commit
fb9ebf2e61

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

@@ -66,14 +66,15 @@ App.YARNService = App.Service.extend({
   }.property('queue'),
   allQueueNames: [],
   childQueueNames: [],
-  /** 
-   * Provides a flat array of queue names.
-   * Example: root, root/default
-   */
+
   maxMemory: function() {
     return this.get('allocatedMemory') + this.get('availableMemory');
   }.property('allocatedMemory','availableMemory'),
 
+  /**
+   * Provides a flat array of queue names.
+   * Example: root, root/default
+   */
   queueNames: function () {
     var queueString = this.get('queue');
     var allQueueNames = [];

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

@@ -64,11 +64,11 @@ App.ChartServiceMetricsYARN_QMR = App.ChartLinearTimeView.extend({
         var seriesData = null;
         if (allocatedData != null && availableData != null) {
           if (typeof allocatedData == "number" && typeof availableData == "number") {
-            seriesData = (availableData != 0) ? (allocatedData * 100) / availableData : 0;
+            seriesData = (availableData == 0 && allocatedData == 0) ? 0 : (allocatedData * 100) / (allocatedData + availableData);
           } else if (allocatedData.length > 0 && availableData.length > 0) {
             seriesData = [];
             for ( var c = 0; c < Math.min(availableData.length, allocatedData.length); c++) {
-              var allocDivAvail =  (availableData[c][0] != 0) ? (allocatedData[c][0] * 100) / availableData[c][0] : 0;
+              var allocDivAvail = (availableData[c][0] == 0 && allocatedData[c][0] == 0) ? 0 : (allocatedData[c][0] * 100) / (availableData[c][0] + allocatedData[c][0]);
               seriesData.push([allocDivAvail, allocatedData[c][1] ]);
             }
           } else {