You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sr...@apache.org on 2013/08/17 00:20:21 UTC

git commit: AMBARI-2940. After restarting YARN, the number of lost nodes is incorrect. (srimanth)

Updated Branches:
  refs/heads/trunk 4b6df8424 -> 22ff085f1


AMBARI-2940. After restarting YARN, the number of lost nodes is incorrect. (srimanth)


Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/22ff085f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/22ff085f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/22ff085f

Branch: refs/heads/trunk
Commit: 22ff085f16689cebf020a1374d1c46d973c6fc4d
Parents: 4b6df84
Author: Srimanth Gunturi <sg...@hortonworks.com>
Authored: Fri Aug 16 15:13:17 2013 -0700
Committer: Srimanth Gunturi <sg...@hortonworks.com>
Committed: Fri Aug 16 15:16:34 2013 -0700

----------------------------------------------------------------------
 ambari-web/app/mappers/service_mapper.js |  2 +-
 ambari-web/app/models/service/yarn.js    | 16 +++++++++++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/22ff085f/ambari-web/app/mappers/service_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/service_mapper.js b/ambari-web/app/mappers/service_mapper.js
index 8ea2fda..3a5414e 100644
--- a/ambari-web/app/mappers/service_mapper.js
+++ b/ambari-web/app/mappers/service_mapper.js
@@ -101,7 +101,7 @@ App.servicesMapper = App.QuickDataMapper.create({
     apps_killed: 'resourceManagerComponent.host_components[0].metrics.yarn.Queue.root.AppsKilled',
     apps_failed: 'resourceManagerComponent.host_components[0].metrics.yarn.Queue.root.AppsFailed',
     node_managers_count_active: 'resourceManagerComponent.ServiceComponentInfo.rm_metrics.cluster.activeNMcount',
-    node_managers_count_lost: 'resourceManagerComponent.ServiceComponentInfo.rm_metrics.cluster.lostNMcount',
+    //node_managers_count_lost: 'resourceManagerComponent.ServiceComponentInfo.rm_metrics.cluster.lostNMcount',
     node_managers_count_unhealthy: 'resourceManagerComponent.ServiceComponentInfo.rm_metrics.cluster.unhealthyNMcount',
     node_managers_count_rebooted: 'resourceManagerComponent.ServiceComponentInfo.rm_metrics.cluster.rebootedNMcount',
     node_managers_count_decommissioned: 'resourceManagerComponent.ServiceComponentInfo.rm_metrics.cluster.decommissionedNMcount',

http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/22ff085f/ambari-web/app/models/service/yarn.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/service/yarn.js b/ambari-web/app/models/service/yarn.js
index 4ca120f..b9c7016 100644
--- a/ambari-web/app/models/service/yarn.js
+++ b/ambari-web/app/models/service/yarn.js
@@ -24,7 +24,6 @@ App.YARNService = App.Service.extend({
   nodeManagerNodes: DS.hasMany('App.Host'),
   nodeManagerLiveNodes: DS.hasMany('App.Host'),
   nodeManagersCountActive: DS.attr('number'),
-  nodeManagersCountLost: DS.attr('number'),
   nodeManagersCountUnhealthy: DS.attr('number'),
   nodeManagersCountRebooted: DS.attr('number'),
   nodeManagersCountDecommissioned: DS.attr('number'),
@@ -85,6 +84,21 @@ App.YARNService = App.Service.extend({
     this.set('allQueueNames', allQueueNames);
     this.set('childQueueNames', childQueueNames);
   }.observes('queue'),
+  /**
+   * ResourceManager's lost count is not accurate once RM is rebooted. Since
+   * Ambari knows the total number of nodes and the counts of nodes in other
+   * states, we calculate the lost count.
+   */
+  nodeManagersCountLost: function () {
+    var allNMs = this.get('nodeManagerNodes');
+    var totalCount = allNMs != null ? allNMs.get('length') : 0;
+    var activeCount = this.get('nodeManagersCountActive');
+    var rebootedCount = this.get('nodeManagersCountRebooted');
+    var unhealthyCount = this.get('nodeManagersCountUnhealthy');
+    var decomCount = this.get('nodeManagersCountDecommissioned');
+    var nonLostHostsCount = activeCount + rebootedCount + decomCount + unhealthyCount;
+    return totalCount >= nonLostHostsCount ? totalCount - nonLostHostsCount : 0;
+  }.property('nodeManagerNodes', 'nodeManagersCountActive', 'nodeManagersCountRebooted', 'nodeManagersCountUnhealthy', 'nodeManagersCountDecommissioned'),
 });
 
 App.YARNService.FIXTURES = [];