You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by db...@apache.org on 2016/06/17 02:35:50 UTC
ambari git commit: AMBARI-17109. Capacity scheduler view - problem
with queue percent rounding. (Akhil PB via dipayanb)
Repository: ambari
Updated Branches:
refs/heads/branch-2.4 f0fd29c0b -> 3f160ad4f
AMBARI-17109. Capacity scheduler view - problem with queue percent rounding. (Akhil PB via dipayanb)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/3f160ad4
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/3f160ad4
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/3f160ad4
Branch: refs/heads/branch-2.4
Commit: 3f160ad4f8a72cd8658f188050d9be5e3957b868
Parents: f0fd29c
Author: Dipayan Bhowmick <di...@gmail.com>
Authored: Fri Jun 17 08:05:32 2016 +0530
Committer: Dipayan Bhowmick <di...@gmail.com>
Committed: Fri Jun 17 08:05:32 2016 +0530
----------------------------------------------------------------------
.../main/resources/ui/app/components/totalCapacity.js | 13 +++++++++++--
.../src/main/resources/ui/app/controllers/queues.js | 1 +
2 files changed, 12 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f160ad4/contrib/views/capacity-scheduler/src/main/resources/ui/app/components/totalCapacity.js
----------------------------------------------------------------------
diff --git a/contrib/views/capacity-scheduler/src/main/resources/ui/app/components/totalCapacity.js b/contrib/views/capacity-scheduler/src/main/resources/ui/app/components/totalCapacity.js
index c36839c..cb0c6b0 100644
--- a/contrib/views/capacity-scheduler/src/main/resources/ui/app/components/totalCapacity.js
+++ b/contrib/views/capacity-scheduler/src/main/resources/ui/app/components/totalCapacity.js
@@ -119,7 +119,14 @@ App.TotalCapacityComponent = Ember.Component.extend({
* Sum of leaf queues capacities.
* @type {Number}
*/
- totalCapacity: Ember.computed.sum('leafQueuesCapacity'),
+ totalCapacity: function() {
+ var leafCaps = this.get('leafQueuesCapacity');
+ var total = leafCaps.reduce(function(prev, cap) {
+ return prev + cap;
+ }, 0);
+ total = parseFloat(total.toFixed(3));
+ return total;
+ }.property('leafQueuesCapacity', 'leafQueuesCapacity.length', 'leafQueuesCapacity.@each.capacity'),
/**
* Node labels stored in store.
@@ -266,9 +273,11 @@ App.TotalCapacityComponent = Ember.Component.extend({
* @return {Number}
*/
capacityValue:function () {
- return this.get('labels').reduce(function (prev, label) {
+ var total = this.get('labels').reduce(function (prev, label) {
return prev + ((label && label.get('capacity'))?+label.get('capacity'):0);
}, 0);
+ total = parseFloat(total.toFixed(3));
+ return total;
}.property('labels.@each.capacity','labels.[]'),
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/3f160ad4/contrib/views/capacity-scheduler/src/main/resources/ui/app/controllers/queues.js
----------------------------------------------------------------------
diff --git a/contrib/views/capacity-scheduler/src/main/resources/ui/app/controllers/queues.js b/contrib/views/capacity-scheduler/src/main/resources/ui/app/controllers/queues.js
index 4aeb442..2f9f2fe 100644
--- a/contrib/views/capacity-scheduler/src/main/resources/ui/app/controllers/queues.js
+++ b/contrib/views/capacity-scheduler/src/main/resources/ui/app/controllers/queues.js
@@ -247,6 +247,7 @@ App.QueuesController = Ember.ArrayController.extend({
return +queue.get('capacity') + prev;
},0);
+ total = parseFloat(total.toFixed(3));
leaf.setEach('overCapacity',total != 100);
}.bind(this));
}.observes('content.length','content.@each.capacity'),