Author: yusaku
Date: Fri Jan 11 01:31:41 2013
New Revision: 1431780
URL: http://svn.apache.org/viewvc?rev=1431780&view=rev
Log:
AMBARI-1145. Cluster Management refactoring. (yusaku)
Modified:
incubator/ambari/trunk/ambari-web/app/controllers/main/service/info/configs.js
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step2_controller.js
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step8_controller.js
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step9_controller.js
incubator/ambari/trunk/ambari-web/app/data/config_mapping.js
incubator/ambari/trunk/ambari-web/app/mappers/service_mapper.js
incubator/ambari/trunk/ambari-web/app/messages.js
incubator/ambari/trunk/ambari-web/app/models/service.js
incubator/ambari/trunk/ambari-web/app/views/main/service/info/summary.js
Modified:
incubator/ambari/trunk/ambari-web/app/controllers/main/service/info/configs.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/main/service/info/configs.js?rev=1431780&r1=1431779&r2=1431780&view=diff
==============================================================================
---
incubator/ambari/trunk/ambari-web/app/controllers/main/service/info/configs.js
(original)
+++
incubator/ambari/trunk/ambari-web/app/controllers/main/service/info/configs.js
Fri Jan 11 01:31:41 2013
@@ -227,17 +227,19 @@ App.MainServiceInfoConfigsController = E
* Render a custom conf-site box for entering properties that will be
written in *-site.xml files of the services
*/
loadCustomConfig: function (serviceConfigs) {
- var customConfigs = this.get('customConfigs').findProperty('serviceName',
this.get('content.serviceName'));
- var customValue = '';
- var length = this.get('customConfig').length;
- this.get('customConfig').forEach(function (_config, index) {
- customValue += _config.name + '=' + _config.value;
- if (index !== length - 1) {
- customValue += '\n';
- }
- }, this);
- customConfigs.value = customValue;
- serviceConfigs.pushObject(customConfigs);
+ if (this.get('customConfigs').findProperty('serviceName',
this.get('content.serviceName'))) {
+ var customConfigs =
this.get('customConfigs').findProperty('serviceName',
this.get('content.serviceName'));
+ var customValue = '';
+ var length = this.get('customConfig').length;
+ this.get('customConfig').forEach(function (_config, index) {
+ customValue += _config.name + '=' + _config.value;
+ if (index !== length - 1) {
+ customValue += '\n';
+ }
+ }, this);
+ customConfigs.value = customValue;
+ serviceConfigs.pushObject(customConfigs);
+ }
},
@@ -671,6 +673,8 @@ App.MainServiceInfoConfigsController = E
if (this.get('globalConfigs').someProperty('name',
config.templateName[index])) {
var globalValue = this.get('globalConfigs').findProperty('name',
config.templateName[index]).value;
config.value = config.value.replace(_value, globalValue);
+ } else {
+ config.value = null;
}
}, this);
}
@@ -922,9 +926,6 @@ App.MainServiceInfoConfigsController = E
var oozieServerHost = serviceConfigs.findProperty('name',
'oozieserver_host');
oozieServerHost.defaultValue =
this.get('content.components').findProperty('componentName',
'OOZIE_SERVER').get('host.hostName');
globalConfigs.push(oozieServerHost);
- var oozieAmbariHost = serviceConfigs.findProperty('name',
'oozie_ambari_host'); //db hostname
- oozieAmbariHost.defaultValue =
this.get('content.components').findProperty('componentName',
'OOZIE_SERVER').get('host.hostName');
- globalConfigs.push(oozieAmbariHost);
break;
case 'HBASE':
var hbaseMasterHost = serviceConfigs.findProperty('name',
'hbasemaster_host');
Modified:
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step2_controller.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/wizard/step2_controller.js?rev=1431780&r1=1431779&r2=1431780&view=diff
==============================================================================
---
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step2_controller.js
(original)
+++
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step2_controller.js
Fri Jan 11 01:31:41 2013
@@ -140,6 +140,10 @@ App.WizardStep2Controller = Em.Controlle
return false;
}
+ if (this.get('sshKeyError')) {
+ return false;
+ }
+
this.updateHostNameArr();
if(this.isPattern)
Modified:
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step8_controller.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/wizard/step8_controller.js?rev=1431780&r1=1431779&r2=1431780&view=diff
==============================================================================
---
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step8_controller.js
(original)
+++
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step8_controller.js
Fri Jan 11 01:31:41 2013
@@ -61,12 +61,12 @@ App.WizardStep8Controller = Em.Controlle
var hiveDb = globals.findProperty('name', 'hive_database');
if (hiveDb.value === 'New MySQL Database') {
if (globals.someProperty('name', 'hive_ambari_host')) {
- globals.findProperty('name', 'hive_ambari_host').name =
'hive_mysql_host';
+ globals.findProperty('name', 'hive_ambari_host').name =
'hive_mysql_hostname';
}
globals = globals.without(globals.findProperty('name',
'hive_existing_host'));
globals = globals.without(globals.findProperty('name',
'hive_existing_database'));
} else {
- globals.findProperty('name', 'hive_existing_host').name =
'hive_mysql_host';
+ globals.findProperty('name', 'hive_existing_host').name =
'hive_mysql_hostname';
globals = globals.without(globals.findProperty('name',
'hive_ambari_host'));
globals = globals.without(globals.findProperty('name',
'hive_ambari_database'));
}
@@ -134,19 +134,23 @@ App.WizardStep8Controller = Em.Controlle
//console.log("The name of the variable is: " +
this.get('content.serviceConfigProperties').findProperty('name',
templateName[index]).name);
var globValue = this.get('globals').findProperty('name',
templateName[index]).value;
// Hack for templeton.zookeeper.hosts
- if (name === "templeton.zookeeper.hosts") {
- var zooKeeperPort = '2181';
- if(typeof globValue === 'string') {
- var temp = [];
- temp.push(globValue);
- globValue = temp;
+ if (value !== null) { // if the property depends on more than one
template name like <templateName[0]>/<templateName[1]> then don't proceed to
the next if the prior is null or not found in the global configs
+ if (name === "templeton.zookeeper.hosts" || name ===
'hbase.zookeeper.quorum') {
+ var zooKeeperPort = '2181';
+ if (typeof globValue === 'string') {
+ var temp = [];
+ temp.push(globValue);
+ globValue = temp;
+ }
+ if (name === "templeton.zookeeper.hosts") {
+ globValue.forEach(function (_host, index) {
+ globValue[index] = globValue[index] + ':' + zooKeeperPort;
+ }, this);
+ }
+ value = value.replace(_express, globValue.toString());
+ } else {
+ value = value.replace(_express, globValue);
}
- globValue.forEach(function (_host,index) {
- globValue[index] = globValue[index] + ':' + zooKeeperPort;
- }, this);
- value = value.replace(_express, globValue.toString());
- } else {
- value = value.replace(_express, globValue);
}
} else {
/*
@@ -155,7 +159,7 @@ App.WizardStep8Controller = Em.Controlle
"content.serviceConfigProperties. Two possible reasons for the error
could be: 1) The service is not selected. " +
"and/OR 2) The service_config metadata file has no corresponding
global var for the site property variable");
*/
- //value = null;
+ value = null;
}
}, this);
return value;
@@ -200,6 +204,7 @@ App.WizardStep8Controller = Em.Controlle
}, this);
}
//For properties in the configMapping file having foreignKey and
templateName properties.
+
var templateValue = config.value.match(/<(templateName.*?)>/g);
if (templateValue) {
templateValue.forEach(function (_value) {
@@ -207,6 +212,8 @@ App.WizardStep8Controller = Em.Controlle
if (this.get('globals').someProperty('name',
config.templateName[index])) {
var globalValue = this.get('globals').findProperty('name',
config.templateName[index]).value;
config.value = config.value.replace(_value, globalValue);
+ } else {
+ config.value = null;
}
}, this);
}
@@ -1281,7 +1288,7 @@ App.WizardStep8Controller = Em.Controlle
}, this);
hiveProperties['hive.metastore.uris'] = 'thrift://' +
this.get('globals').findProperty('name', 'hivemetastore_host').value + ':9083';
hiveProperties['javax.jdo.option.ConnectionURL'] =
- 'jdbc:mysql://' + this.get('globals').findProperty('name',
'hive_mysql_host').value +
+ 'jdbc:mysql://' + this.get('globals').findProperty('name',
'hive_mysql_hostname').value +
'/' + this.get('globals').findProperty('name',
'hive_database_name').value + '?createDatabaseIfNotExist=true';
return {type: 'hive-site', tag: 'version1', properties: hiveProperties};
},
Modified:
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step9_controller.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/wizard/step9_controller.js?rev=1431780&r1=1431779&r2=1431780&view=diff
==============================================================================
---
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step9_controller.js
(original)
+++
incubator/ambari/trunk/ambari-web/app/controllers/wizard/step9_controller.js
Fri Jan 11 01:31:41 2013
@@ -117,10 +117,12 @@ App.WizardStep9Controller = Em.Controlle
loadHosts: function () {
var hostInfo = this.get('content.hosts');
-
var hosts = new Ember.Set();
for (var index in hostInfo) {
var obj = Em.Object.create(hostInfo[index]);
+ obj.message = '';
+ obj.progress = 0;
+ obj.status = 'info';
obj.tasks = [];
obj.logTasks = [];
hosts.add(obj);
Modified: incubator/ambari/trunk/ambari-web/app/data/config_mapping.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/data/config_mapping.js?rev=1431780&r1=1431779&r2=1431780&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/data/config_mapping.js (original)
+++ incubator/ambari/trunk/ambari-web/app/data/config_mapping.js Fri Jan 11
01:31:41 2013
@@ -67,6 +67,13 @@ module.exports = [
"filename": "core-site.xml"
},
{
+ "name": "hadoop.proxyuser.<foreignKey[0]>.hosts",
+ "templateName": ["oozieserver_host"],
+ "foreignKey": ["oozie_user"],
+ "value": "<templateName[0]>",
+ "filename": "core-site.xml"
+ },
+ {
"name": "hadoop.proxyuser.<foreignKey[0]>.groups",
"templateName": ["proxyuser_group"],
"foreignKey": ["webhcat_user"],
@@ -75,8 +82,8 @@ module.exports = [
},
{
"name": "hadoop.proxyuser.<foreignKey[0]>.hosts",
- "templateName": ["oozieserver_host"],
- "foreignKey": ["oozie_user"],
+ "templateName": ["hivemetastore_host"],
+ "foreignKey": ["webhcat_user"],
"value": "<templateName[0]>",
"filename": "core-site.xml"
},
Modified: incubator/ambari/trunk/ambari-web/app/mappers/service_mapper.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/mappers/service_mapper.js?rev=1431780&r1=1431779&r2=1431780&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/mappers/service_mapper.js (original)
+++ incubator/ambari/trunk/ambari-web/app/mappers/service_mapper.js Fri Jan 11
01:31:41 2013
@@ -145,41 +145,54 @@ App.servicesMapper = App.QuickDataMapper
}
if (json.items) {
-
- // Host components
var result = [];
- json.items.forEach(function(item){
- item.components.forEach(function(component){
- component.host_components.forEach(function(host_component){
- result.push(this.parseIt(host_component, this.config3));
+ json.items.forEach(function (item) {
+ var finalConfig = jQuery.extend({}, this.config);
+ var finalJson = [];
+ item.host_components = [];
+// var json = this.parseIt(item, this.config);
+// if(App.Service.find().someProperty('id', json.id)){
+// var fieldsToUpdate = [
+// 'work_status',
+// 'components',
+// 'host_components'
+// ]
+// this.updateRecord(App.Service.find().findProperty('id', json.id),
json, fieldsToUpdate);
+// return;
+// }
+
+ if
(this.get('model').find(item.ServiceInfo.service_name).get('isLoaded')) {
+ this.update(item);
+ return;
+ }
+ item.components.forEach(function (component) {
+ component.host_components.forEach(function (host_component) {
+ host_component.id = host_component.HostRoles.component_name + "_"
+ host_component.HostRoles.host_name;
+ item.host_components.push(host_component.id);
}, this)
- }, this)
- }, this);
- var newHostComponents = [];
- result.forEach(function(hcJson){
- hcJson.id = hcJson.component_name + '_' + hcJson.host_id;
- var component = App.HostComponent.find(hcJson.id);
- if (component && component.get('isLoaded')) { // UPDATE
- if (hcJson.work_status) {
- component.set('workStatus', hcJson.work_status);
- }
- if (hcJson.component_name) {
- component.set('componentName', hcJson.component_name);
- }
- if (hcJson.host_id) {
- component.set('host', App.Host.find(hcJson.host_id));
- }
- if (hcJson.service_id) {
- component.set('service', App.Service.find(hcJson.service_id));
- }
+ }, this);
+
+ if (item && item.ServiceInfo && item.ServiceInfo.service_name ==
"HDFS") {
+ // Change the JSON so that it is easy to map
+ finalJson = this.hdfsMapper(item);
+ result.push(finalJson);
+ App.store.load(App.HDFSService, finalJson);
+ } else if (item && item.ServiceInfo && item.ServiceInfo.service_name
== "MAPREDUCE") {
+ finalJson = this.mapreduceMapper(item);
+ result.push(finalJson);
+ App.store.load(App.MapReduceService, finalJson);
+ } else if (item && item.ServiceInfo && item.ServiceInfo.service_name
== "HBASE") {
+ finalJson = this.hbaseMapper(item);
+ result.push(finalJson);
+ App.store.load(App.HBaseService, finalJson);
} else {
- newHostComponents.push(hcJson);
+ result.push(this.parseIt(item, this.config));
}
- });
+ }, this);
- if (newHostComponents.length > 0) {
- App.store.loadMany(this.get('model3'), newHostComponents);
- }
+
+ result = this.sortByOrder(this.get('servicesSortOrder'), result);
+ App.store.loadMany(this.get('model'), result);
// Service components
result = [];
@@ -202,110 +215,43 @@ App.servicesMapper = App.QuickDataMapper
newComponents.push(componentJson);
}
});
-
if (newComponents.length > 0) {
App.store.loadMany(this.get('model2'), newComponents);
}
- //Services
- var newServices = [];
- json.items.forEach(function (item) {
- var finalJson = {};
- var serviceJson = this.parseIt(item, this.config);
- var serviceFields = [
- 'work_status',
- 'components',
- 'host_components'
- ]
- if (item && item.ServiceInfo && item.ServiceInfo.service_name ==
"HDFS") {
- // Change the JSON so that it is easy to map
- finalJson = this.hdfsMapper(item);
- if(App.Service.find().someProperty('id', serviceJson.id)){
- var hdfsFields = [
- 'version',
- 'name_node_start_time',
- 'jvm_memory_heap_committed',
- 'jvm_memory_heap_used',
- 'capacity_used',
- 'capacity_total',
- 'dfs_total_blocks',
- 'dfs_corrupt_blocks',
- 'dfs_missing_blocks',
- 'dfs_under_replicated_blocks',
- 'dfs_total_files',
- 'upgrade_status',
- 'safe_mode_status',
- 'decommission_data_nodes',
- 'live_data_nodes',
- 'dead_data_nodes'
- ];
- this.updateRecord(App.Service.find().findProperty('id',
serviceJson.id), serviceJson, serviceFields);
- this.updateRecord(App.HDFSService.find().findProperty('id',
finalJson.id), finalJson, hdfsFields);
- } else {
- newServices.push(serviceJson);
- App.store.load(App.HDFSService, finalJson);
+ // Host components
+ result = [];
+ json.items.forEach(function(item){
+ item.components.forEach(function(component){
+ component.host_components.forEach(function(host_component){
+ result.push(this.parseIt(host_component, this.config3));
+ }, this)
+ }, this)
+ }, this);
+ var newHostComponents = [];
+ result.forEach(function(hcJson){
+ hcJson.id = hcJson.component_name + '_' + hcJson.host_id;
+ var component = App.HostComponent.find(hcJson.id);
+ if (component && component.get('isLoaded')) { // UPDATE
+ if (hcJson.work_status) {
+ component.set('workStatus', hcJson.work_status);
}
- } else if (item && item.ServiceInfo && item.ServiceInfo.service_name
== "MAPREDUCE") {
- finalJson = this.mapreduceMapper(item);
- if(App.Service.find().someProperty('id', serviceJson.id)){
- var mapReduceFields = [
- 'version',
- 'job_tracker_start_time',
- 'job_tracker_heap_used)',
- 'job_tracker_heap_max',
- 'map_slots',
- 'reduce_slots',
- 'jobs_submitted',
- 'jobs_completed',
- 'map_slots_occupied',
- 'map_slots_reserved',
- 'reduce_slots_occupied',
- 'reduce_slots_reserved)',
- 'maps_running',
- 'maps_waiting',
- 'reduces_running',
- 'reduces_waiting',
- 'trackers_decommissioned'
- ]
- this.updateRecord(App.Service.find().findProperty('id',
finalJson.id), serviceJson, serviceFields);
- this.updateRecord(App.MapReduceService.find().findProperty('id',
finalJson.id), finalJson, mapReduceFields);
- } else {
- newServices.push(serviceJson);
- App.store.load(App.MapReduceService, finalJson);
+ if (hcJson.component_name) {
+ component.set('componentName', hcJson.component_name);
}
- } else if (item && item.ServiceInfo && item.ServiceInfo.service_name
== "HBASE") {
- finalJson = this.hbaseMapper(item);
- if(App.Service.find().someProperty('id', serviceJson.id)){
- var hbaseFields = [
- 'version',
- 'master_start_time',
- 'master_active_time',
- 'average_load',
- 'regions_in_transition',
- 'revision',
- 'heap_memory_used',
- 'heap_memory_max'
- ]
- this.updateRecord(App.Service.find().findProperty('id',
serviceJson.id), serviceJson, serviceFields);
- this.updateRecord(App.HBaseService.find().findProperty('id',
finalJson.id), finalJson, hbaseFields);
- } else {
- newServices.push(serviceJson);
- App.store.load(App.HBaseService, finalJson);
+ if (hcJson.host_id) {
+ component.set('host', App.Host.find(hcJson.host_id));
}
- } else {
- if(App.Service.find().someProperty('id', serviceJson.id)){
- this.updateRecord(App.Service.find().findProperty('id',
serviceJson.id), serviceJson, serviceFields);
- } else {
- newServices.push(serviceJson);
+ if (hcJson.service_id) {
+ component.set('service', App.Service.find(hcJson.service_id));
}
+ } else {
+ newHostComponents.push(hcJson);
}
- }, this);
-
- if(newServices.length){
- newServices = this.sortByOrder(this.get('servicesSortOrder'),
newServices);
- App.store.loadMany(this.get('model'), newServices);
+ });
+ if (newHostComponents.length > 0) {
+ App.store.loadMany(this.get('model3'), newHostComponents);
}
- //App.store.commit();
}
},
update: function (service) {
@@ -531,8 +477,7 @@ App.servicesMapper = App.QuickDataMapper
return finalJson;
},
updateRecord: function (record, json, fieldsToUpdate) {
- for (var i = 0; i < fieldsToUpdate.length; i++) {
- var field = fieldsToUpdate[i];
+ for (var field in fieldsToUpdate) {
if (json[field] !== undefined) {
if(json[field] instanceof Array){
this.updateHasMany(record, stringUtils.underScoreToCamelCase(field),
json[field]);
Modified: incubator/ambari/trunk/ambari-web/app/messages.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/messages.js?rev=1431780&r1=1431779&r2=1431780&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/messages.js (original)
+++ incubator/ambari/trunk/ambari-web/app/messages.js Fri Jan 11 01:31:41 2013
@@ -153,7 +153,7 @@ Em.I18n.translations = {
'installer.step9.host.status.success':'Success',
'installer.step9.host.status.warning':'Warnings encountered',
'installer.step9.host.status.failed':'Failures encountered',
- 'installer.step9.host.status.nothingToInstall':'Nothing to install',
+ 'installer.step9.host.status.nothingToInstall':'Waiting (Nothing to
install)',
'installer.step9.hostLog.popup.header':'Tasks. executed on ',
'installer.step10.header':'Summary',
Modified: incubator/ambari/trunk/ambari-web/app/models/service.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/models/service.js?rev=1431780&r1=1431779&r2=1431780&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/models/service.js (original)
+++ incubator/ambari/trunk/ambari-web/app/models/service.js Fri Jan 11 01:31:41
2013
@@ -66,6 +66,7 @@ App.Service = DS.Model.extend({
"HBASE",
"OOZIE",
"HIVE",
+ "WEBHCAT",
"ZOOKEEPER",
"PIG",
"SQOOP"
@@ -81,6 +82,7 @@ App.Service = DS.Model.extend({
"HBASE",
"OOZIE",
"HIVE",
+ "WEBHCAT",
"ZOOKEEPER",
"PIG",
"SQOOP",
Modified:
incubator/ambari/trunk/ambari-web/app/views/main/service/info/summary.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/views/main/service/info/summary.js?rev=1431780&r1=1431779&r2=1431780&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/views/main/service/info/summary.js
(original)
+++ incubator/ambari/trunk/ambari-web/app/views/main/service/info/summary.js
Fri Jan 11 01:31:41 2013
@@ -307,8 +307,7 @@ App.MainServiceInfoSummaryView = Em.View
}
}
return graphs;
- //we don't need to bind graphs to service property they update by
themselves
- }.property(),
+ }.property('service'),
loadServiceSummary:function (serviceName) {