You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by at...@apache.org on 2013/11/01 13:21:04 UTC
git commit: AMBARI-3650 Poll for host_components which have
stale_configs. (atkach)
Updated Branches:
refs/heads/trunk c864766af -> 87e914c1b
AMBARI-3650 Poll for host_components which have stale_configs. (atkach)
Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/87e914c1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/87e914c1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/87e914c1
Branch: refs/heads/trunk
Commit: 87e914c1b3dce97f55791ede7ee7bc80a1823264
Parents: c864766
Author: atkach <an...@gmail.com>
Authored: Fri Nov 1 14:20:55 2013 +0200
Committer: atkach <an...@gmail.com>
Committed: Fri Nov 1 14:20:55 2013 +0200
----------------------------------------------------------------------
.../services/host_component_stale_configs.json | 42 ++++++++++++++
.../controllers/global/cluster_controller.js | 8 ++-
.../app/controllers/global/update_controller.js | 10 ++++
.../controllers/main/service/info/configs.js | 1 +
ambari-web/app/initialize.js | 5 +-
.../app/mappers/component_config_mapper.js | 61 ++++++++++++++++++++
ambari-web/app/models/service.js | 2 +-
ambari-web/app/views/main/host/summary.js | 4 +-
8 files changed, 127 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/87e914c1/ambari-web/app/assets/data/services/host_component_stale_configs.json
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/data/services/host_component_stale_configs.json b/ambari-web/app/assets/data/services/host_component_stale_configs.json
new file mode 100644
index 0000000..e256ff0
--- /dev/null
+++ b/ambari-web/app/assets/data/services/host_component_stale_configs.json
@@ -0,0 +1,42 @@
+{
+ "href" : "http://192.168.56.101:8080/api/v1/clusters/cl/host_components?fields=HostRoles/component_name&HostRoles/stale_configs=true",
+ "items" : [
+ {
+ "href" : "http://192.168.56.101:8080/api/v1/clusters/cl/hosts/dev01.hortonworks.com/host_components/HBASE_CLIENT",
+ "HostRoles" : {
+ "cluster_name" : "cl",
+ "component_name" : "HBASE_CLIENT",
+ "host_name" : "dev01.hortonworks.com",
+ "stale_configs" : true
+ },
+ "host" : {
+ "href" : "http://192.168.56.101:8080/api/v1/clusters/cl/hosts/dev01.hortonworks.com"
+ }
+ },
+ {
+ "href" : "http://192.168.56.101:8080/api/v1/clusters/cl/hosts/dev01.hortonworks.com/host_components/HBASE_MASTER",
+ "HostRoles" : {
+ "cluster_name" : "cl",
+ "component_name" : "HBASE_MASTER",
+ "ha_status" : "passive",
+ "host_name" : "dev01.hortonworks.com",
+ "stale_configs" : true
+ },
+ "host" : {
+ "href" : "http://192.168.56.101:8080/api/v1/clusters/cl/hosts/dev01.hortonworks.com"
+ }
+ },
+ {
+ "href" : "http://192.168.56.101:8080/api/v1/clusters/cl/hosts/dev01.hortonworks.com/host_components/HBASE_REGIONSERVER",
+ "HostRoles" : {
+ "cluster_name" : "cl",
+ "component_name" : "HBASE_REGIONSERVER",
+ "host_name" : "dev01.hortonworks.com",
+ "stale_configs" : true
+ },
+ "host" : {
+ "href" : "http://192.168.56.101:8080/api/v1/clusters/cl/hosts/dev01.hortonworks.com"
+ }
+ }
+ ]
+}
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/87e914c1/ambari-web/app/controllers/global/cluster_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/cluster_controller.js b/ambari-web/app/controllers/global/cluster_controller.js
index 8e1860c..492ed3d 100644
--- a/ambari-web/app/controllers/global/cluster_controller.js
+++ b/ambari-web/app/controllers/global/cluster_controller.js
@@ -60,7 +60,8 @@ App.ClusterController = Em.Controller.extend({
'users':false,
'datasets':false,
'targetclusters':false,
- 'status': false
+ 'status': false,
+ 'componentConfigs': !App.supports.hostOverrides
}),
/**
@@ -375,6 +376,11 @@ App.ClusterController = Em.Controller.extend({
self.loadUpdatedStatus(function(){
self.updateLoadStatus('status');
});
+ if (App.supports.hostOverrides) {
+ App.router.get('updateController').updateComponentConfig(function () {
+ self.updateLoadStatus('componentConfigs');
+ });
+ }
self.updateLoadStatus('services');
}, true);
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/87e914c1/ambari-web/app/controllers/global/update_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/update_controller.js b/ambari-web/app/controllers/global/update_controller.js
index d0faa71..68c2977 100644
--- a/ambari-web/app/controllers/global/update_controller.js
+++ b/ambari-web/app/controllers/global/update_controller.js
@@ -40,6 +40,9 @@ App.UpdateController = Em.Controller.extend({
App.updater.run(this, 'updateHost', 'isWorking');
App.updater.run(this, 'updateServiceMetric', 'isWorking');
App.updater.run(this, 'graphsUpdate', 'isWorking');
+ if (App.supports.hostOverrides) {
+ App.updater.run(this, 'updateComponentConfig', 'isWorking');
+ }
}
}.observes('isWorking'),
@@ -135,6 +138,13 @@ App.UpdateController = Em.Controller.extend({
callback();
}
});
+ },
+ updateComponentConfig: function (callback) {
+ var testUrl = '/data/services/host_component_stale_configs.json';
+ var componentConfigUrl = this.getUrl(testUrl, '/host_components?fields=HostRoles/component_name&HostRoles/stale_configs=true');
+ App.HttpClient.get(componentConfigUrl, App.componentConfigMapper, {
+ complete: callback
+ });
}
});
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/87e914c1/ambari-web/app/controllers/main/service/info/configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/info/configs.js b/ambari-web/app/controllers/main/service/info/configs.js
index 9ceb8ee..f139a8d 100644
--- a/ambari-web/app/controllers/main/service/info/configs.js
+++ b/ambari-web/app/controllers/main/service/info/configs.js
@@ -614,6 +614,7 @@ App.MainServiceInfoConfigsController = Em.Controller.extend({
dfd.done(function () {
var result = self.saveServiceConfigProperties();
App.router.get('clusterController').updateClusterData();
+ App.router.get('updateController').updateComponentConfig(function(){});
flag = result.flag;
if (result.flag === true) {
header = Em.I18n.t('services.service.config.saved');
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/87e914c1/ambari-web/app/initialize.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/initialize.js b/ambari-web/app/initialize.js
index 17d7c9b..bf7ca99 100644
--- a/ambari-web/app/initialize.js
+++ b/ambari-web/app/initialize.js
@@ -25,7 +25,7 @@ require('messages');
require('utils/base64');
require('utils/db');
require('utils/helper');
-require('utils/config')
+require('utils/config');
require('models');
require('controllers');
require('templates');
@@ -33,7 +33,7 @@ require('views');
require('router');
require('utils/ajax');
-require('utils/updater');;
+require('utils/updater');
require('mappers/server_data_mapper');
require('mappers/status_mapper');
@@ -47,6 +47,7 @@ require('mappers/users_mapper');
require('mappers/service_mapper');
require('mappers/target_cluster_mapper');
require('mappers/dataset_mapper');
+require('mappers/component_config_mapper');
require('utils/http_client');
require('utils/host_progress_popup');
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/87e914c1/ambari-web/app/mappers/component_config_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/component_config_mapper.js b/ambari-web/app/mappers/component_config_mapper.js
new file mode 100644
index 0000000..afef667
--- /dev/null
+++ b/ambari-web/app/mappers/component_config_mapper.js
@@ -0,0 +1,61 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with this
+ * work for additional information regarding copyright ownership. The ASF
+ * licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+var App = require('app');
+
+/**
+ * The usage of previousResponse is due to detect
+ * which exactly components has stale_configs changed in comparison to previous response
+ */
+var previousResponse = {};
+
+App.componentConfigMapper = App.QuickDataMapper.create({
+ map: function (json) {
+ console.time('App.componentConfigMapper execution time');
+ if (json.items) {
+ var result = {};
+ var currentResponse = {};
+ json.items.forEach(function (component) {
+ if (previousResponse[component.HostRoles.component_name + "_" + component.HostRoles.host_name]) {
+ delete previousResponse[component.HostRoles.component_name + "_" + component.HostRoles.host_name];
+ } else {
+ result[component.HostRoles.component_name + "_" + component.HostRoles.host_name] = true;
+ }
+ currentResponse[component.HostRoles.component_name + "_" + component.HostRoles.host_name] = true;
+ });
+
+ /**
+ * if stale_configs of components became
+ * true:
+ * then they will be in "result" object
+ * false:
+ * then they will be in "previousResponse" object
+ * if stale_configs haven't changed then both objects will be empty and components stay the same
+ */
+ App.HostComponent.find().forEach(function (hostComponent) {
+ if (result[hostComponent.get('id')]) {
+ hostComponent.set('staleConfigs', true);
+ } else if (previousResponse[hostComponent.get('id')]) {
+ hostComponent.set('staleConfigs', false);
+ }
+ }, this);
+
+ previousResponse = currentResponse;
+ }
+ console.timeEnd('App.componentConfigMapper execution time');
+ }
+});
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/87e914c1/ambari-web/app/models/service.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/service.js b/ambari-web/app/models/service.js
index 5319fc7..ebe5b08 100644
--- a/ambari-web/app/models/service.js
+++ b/ambari-web/app/models/service.js
@@ -83,7 +83,7 @@ App.Service = DS.Model.extend({
this.set('restartRequiredHostsAndComponents', hc);
return (rhc.length>0);
- }.property('serviceName', 'hostComponents'),
+ }.property('serviceName', 'hostComponents.@each.staleConfigs'),
/**
* Contains a map of which hosts and host_components
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/87e914c1/ambari-web/app/views/main/host/summary.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/host/summary.js b/ambari-web/app/views/main/host/summary.js
index 51ef1a0..5373269 100644
--- a/ambari-web/app/views/main/host/summary.js
+++ b/ambari-web/app/views/main/host/summary.js
@@ -34,11 +34,11 @@ App.MainHostSummaryView = Em.View.extend({
needToRestartComponentsCount: function() {
return this.get('sortedComponents').filterProperty('staleConfigs', true).length;
- }.property('sortedComponents'),
+ }.property('sortedComponents.@each.staleConfigs'),
needToRestartMessage: function() {
return Em.I18n.t('hosts.host.details.needToRestart').format(this.get('needToRestartComponentsCount'));
- }.property(),
+ }.property('needToRestartComponentsCount'),
/**
* @type: [{String}]