Permalink
Browse files

AMBARI-1059. Refactor cluster management. (yusaku)

  • Loading branch information...
Yusaku Sako
Yusaku Sako committed Dec 9, 2012
1 parent 750bc81 commit 9b15091e8f0ebae95f513fc27a4bf075bd052eda
Showing with 1,799 additions and 786 deletions.
  1. +42 −14 ambari-web/app/assets/data/apps/runs.json
  2. +65 −7 ambari-web/app/assets/data/wizard/bootstrap/single_host_information.json
  3. BIN ambari-web/app/assets/img/spinner.gif
  4. +3 −3 ambari-web/app/controllers/application.js
  5. +52 −22 ambari-web/app/controllers/global/background_operations_controller.js
  6. +20 −71 ambari-web/app/controllers/installer.js
  7. +15 −4 ambari-web/app/controllers/main.js
  8. +12 −23 ambari-web/app/controllers/main/host/add_controller.js
  9. +7 −18 ambari-web/app/controllers/main/service/add_controller.js
  10. +79 −8 ambari-web/app/controllers/wizard.js
  11. +14 −0 ambari-web/app/controllers/wizard/slave_component_groups_controller.js
  12. +2 −2 ambari-web/app/controllers/wizard/step10_controller.js
  13. +3 −19 ambari-web/app/controllers/wizard/step1_controller.js
  14. +71 −16 ambari-web/app/controllers/wizard/step2_controller.js
  15. +137 −68 ambari-web/app/controllers/wizard/step3_controller.js
  16. +1 −0 ambari-web/app/controllers/wizard/step5_controller.js
  17. +41 −21 ambari-web/app/controllers/wizard/step7_controller.js
  18. +379 −217 ambari-web/app/controllers/wizard/step8_controller.js
  19. +25 −32 ambari-web/app/controllers/wizard/step9_controller.js
  20. +2 −1 ambari-web/app/data/config_mapping.js
  21. +226 −11 ambari-web/app/data/config_properties.js
  22. +9 −1 ambari-web/app/data/service_components.js
  23. +1 −1 ambari-web/app/data/service_configs.js
  24. +11 −11 ambari-web/app/messages.js
  25. +6 −3 ambari-web/app/models/hosts.js
  26. +106 −0 ambari-web/app/models/service_config.js
  27. +37 −2 ambari-web/app/router.js
  28. +14 −10 ambari-web/app/routes/add_host_routes.js
  29. +8 −7 ambari-web/app/routes/add_service_routes.js
  30. +13 −15 ambari-web/app/routes/installer.js
  31. +2 −2 ambari-web/app/routes/main.js
  32. +128 −14 ambari-web/app/styles/application.less
  33. +5 −9 ambari-web/app/templates/application.hbs
  34. +1 −1 ambari-web/app/templates/login.hbs
  35. +6 −10 ambari-web/app/templates/main.hbs
  36. +29 −23 ambari-web/app/templates/main/background_operations_popup.hbs
  37. +6 −2 ambari-web/app/templates/main/charts/linear_time.hbs
  38. +1 −1 ambari-web/app/templates/main/dashboard/service/hive.hbs
  39. +2 −1 ambari-web/app/templates/main/dashboard/service/oozie.hbs
  40. +2 −1 ambari-web/app/templates/main/dashboard/service/zookeeper.hbs
  41. +2 −2 ambari-web/app/templates/main/service/info/configs.hbs
  42. +2 −0 ambari-web/app/templates/main/service/info/summary.hbs
  43. +13 −12 ambari-web/app/templates/wizard/step2.hbs
  44. +14 −11 ambari-web/app/templates/wizard/step3.hbs
  45. +2 −2 ambari-web/app/templates/wizard/step7.hbs
  46. +6 −3 ambari-web/app/utils/data_table.js
  47. +15 −17 ambari-web/app/utils/db.js
  48. +2 −1 ambari-web/app/utils/graph.js
  49. +24 −16 ambari-web/app/utils/helper.js
  50. +60 −26 ambari-web/app/views/common/chart/linear_time.js
  51. +10 −1 ambari-web/app/views/common/modal_popup.js
  52. +6 −0 ambari-web/app/views/login.js
  53. +19 −2 ambari-web/app/views/main.js
  54. +8 −1 ambari-web/app/views/main/dashboard/cluster_metrics/cpu.js
  55. +2 −5 ambari-web/app/views/main/host.js
  56. +9 −1 ambari-web/app/views/main/host/metrics/cpu.js
  57. +1 −1 ambari-web/app/views/main/menu.js
  58. +1 −1 ambari-web/app/views/main/service/info/metrics/mapreduce/jvm_heap.js
  59. +1 −1 ambari-web/app/views/main/service/info/metrics/mapreduce/jvm_threads.js
  60. +7 −1 ambari-web/app/views/main/service/info/summary.js
  61. +3 −3 ambari-web/app/views/main/service/item.js
  62. +2 −1 ambari-web/app/views/wizard/step1_view.js
  63. +6 −6 ambari-web/app/views/wizard/step2_view.js
  64. +1 −1 ambari-web/app/views/wizard/step9_view.js
@@ -53,7 +53,9 @@
}
},
"workflowId": "hive_7c779523-6bca-416e-89b3-b01b73a60174",
- "workflowName": "script1-hadoop.pig"
+ "workflowName": "script1-hadoop.pig",
+ "inputBytes": 473423,
+ "outputBytes": 82434
},
{
"elapsedTime": 910360,
@@ -84,7 +86,9 @@
}
},
"workflowId": "pig_5750f4cf-f0d2-4e3d-a7ce-90912b309c12",
- "workflowName": "script1-hadoop.pig"
+ "workflowName": "script1-hadoop.pig",
+ "inputBytes": 923423,
+ "outputBytes": 32434
},
{
"elapsedTime": 920579,
@@ -115,7 +119,9 @@
}
},
"workflowId": "mr_25547729-88f9-4287-a45a-64901a82f22b",
- "workflowName": "script1-hadoop.pig"
+ "workflowName": "script1-hadoop.pig",
+ "inputBytes": 623423,
+ "outputBytes": 42434
},
{
"elapsedTime": 687631,
@@ -138,7 +144,9 @@
}
},
"workflowId": "hive_a5b9c06f-96d2-4ea8-80e0-3c063ae831d4",
- "workflowName": "script2-hadoop.pig"
+ "workflowName": "script2-hadoop.pig",
+ "inputBytes": 483423,
+ "outputBytes": 82434
},
{
"elapsedTime": 905375,
@@ -169,7 +177,9 @@
}
},
"workflowId": "pig_90ac94ff-20c4-4637-8b1c-51379cfe10df",
- "workflowName": "script1-hadoop.pig"
+ "workflowName": "script1-hadoop.pig",
+ "inputBytes": 428423,
+ "outputBytes": 32434
},
{
"elapsedTime": 683055,
@@ -192,7 +202,9 @@
}
},
"workflowId": "hive_c832f923-9bd4-421f-9a51-8f45991d91de",
- "workflowName": "script2-hadoop.pig"
+ "workflowName": "script2-hadoop.pig",
+ "inputBytes": 723423,
+ "outputBytes": 62434
},
{
"elapsedTime": 35150977,
@@ -223,7 +235,9 @@
}
},
"workflowId": "mr_a0aade31-47f8-475b-b887-60a79bcea5c4",
- "workflowName": "script1-hadoop.pig"
+ "workflowName": "script1-hadoop.pig",
+ "inputBytes": 463423,
+ "outputBytes": 57434
},
{
"elapsedTime": 888790,
@@ -254,7 +268,9 @@
}
},
"workflowId": "pig_b4365f79-18da-4db6-bbfd-e8a850d6c6e8",
- "workflowName": "script1-hadoop.pig"
+ "workflowName": "script1-hadoop.pig",
+ "inputBytes": 723423,
+ "outputBytes": 82434
},
{
"elapsedTime": 902653,
@@ -285,7 +301,9 @@
}
},
"workflowId": "hive_b6bf29a4-324f-4435-8ed3-bee10622ea48",
- "workflowName": "script1-hadoop.pig"
+ "workflowName": "script1-hadoop.pig",
+ "inputBytes": 923423,
+ "outputBytes": 52434
},
{
"elapsedTime": 884834,
@@ -316,7 +334,9 @@
}
},
"workflowId": "pig_a6a6fb32-b3fd-4427-ab54-449d0895fbb2",
- "workflowName": "script1-hadoop.pig"
+ "workflowName": "script1-hadoop.pig",
+ "inputBytes": 403423,
+ "outputBytes": 82434
},
{
"elapsedTime": 674392,
@@ -339,7 +359,9 @@
}
},
"workflowId": "pig_f69499b1-a504-433e-8904-0760deb5a183",
- "workflowName": "script2-hadoop.pig"
+ "workflowName": "script2-hadoop.pig",
+ "inputBytes": 423123,
+ "outputBytes": 52434
},
{
"elapsedTime": 926853,
@@ -370,7 +392,9 @@
}
},
"workflowId": "mr_73e04732-ea7f-43b8-9a2f-0f5a30e665da",
- "workflowName": "script1-hadoop.pig"
+ "workflowName": "script1-hadoop.pig",
+ "inputBytes": 523423,
+ "outputBytes": 92434
},
{
"elapsedTime": 0,
@@ -401,7 +425,9 @@
}
},
"workflowId": "pig_31b2111b-cc2e-4024-a8db-d181855a463f",
- "workflowName": "script1-hadoop.pig"
+ "workflowName": "script1-hadoop.pig",
+ "inputBytes": 443423,
+ "outputBytes": 32434
},
{
"elapsedTime": 670929,
@@ -424,6 +450,8 @@
}
},
"workflowId": "hive_097d0698-3620-4232-9c79-4deccbf6c98a",
- "workflowName": "script2-hadoop.pig"
+ "workflowName": "script2-hadoop.pig",
+ "inputBytes": 428423,
+ "outputBytes": 18434
}
]}
@@ -1,12 +1,70 @@
{
- "href" : "http://localhost:8080/api/v1/hosts?fields=Hosts/total_mem,Hosts/cpu_count",
- "items" : [
+ "href": "http://localhost:8080/api/v1/hosts?fields=Hosts/total_mem,Hosts/cpu_count",
+ "items": [
{
- "href" : "http://localhost:8080/api/v1/hosts/localhost.localdomain",
- "Hosts" : {
- "cpu_count" : 1,
- "total_mem" : 4057989,
- "host_name" : "localhost.localdomain"
+ "href": "http://localhost:8080/api/v1/hosts/localhost.localdomain",
+ "Hosts": {
+ "cpu_count": 1,
+ "total_mem": 4057989,
+ "host_name": "localhost.localdomain",
+ "disk_info": [
+ {
+ "available": "47574176",
+ "used": "3507828",
+ "percent": "7%",
+ "size": "51606140",
+ "type": "ext4",
+ "mountpoint": "/"
+ },
+ {
+ "available": "47574176",
+ "used": "3507828",
+ "percent": "7%",
+ "size": "51606140",
+ "type": "ext4",
+ "mountpoint": "/grid/0"
+ },
+ {
+ "available": "1027204",
+ "used": "260",
+ "percent": "1%",
+ "size": "1027464",
+ "type": "tmpfs",
+ "mountpoint": "/dev/shm"
+ },
+ {
+ "available": "432210",
+ "used": "38034",
+ "percent": "9%",
+ "size": "495844",
+ "type": "ext4",
+ "mountpoint": "/boot"
+ },
+ {
+ "available": "44459872",
+ "used": "184220",
+ "percent": "1%",
+ "size": "47033288",
+ "type": "ext4",
+ "mountpoint": "/home"
+ },
+ {
+ "available": "450200708",
+ "used": "281534268",
+ "percent": "39%",
+ "size": "731734976",
+ "type": "vboxsf",
+ "mountpoint": "/media/sf_ambari"
+ },
+ {
+ "available": "450200708",
+ "used": "281534268",
+ "percent": "39%",
+ "size": "731734976",
+ "type": "vboxsf",
+ "mountpoint": "/host"
+ }
+ ]
}
}
]
Binary file not shown.
@@ -23,12 +23,12 @@ App.ApplicationController = Em.Controller.extend({
name: 'applicationController',
clusterName: function () {
- var name = App.db.getClusterName();
+ var name = App.router.get('clusterController.clusterName');
if (name) {
return name.capitalize();
}
- return '';
- }.property(),
+ return Em.I18n.t('installer.header');
+ }.property('App.router.clusterController.clusterName'),
isClusterDataLoaded: function() {
return App.router.get('clusterController.isLoaded');
}.property('App.router.clusterController.isLoaded'),
@@ -28,6 +28,11 @@ App.BackgroundOperationsController = Em.Controller.extend({
allOperations: [],
allOperationsCount : 0,
+ executeTasks: [],
+
+ getTasksByRole: function (role) {
+ return this.get('allOperations').filterProperty('role', role);
+ },
getOperationsForRequestId: function(requestId){
return this.get('allOperations').filterProperty('request_id', requestId);
@@ -129,45 +134,69 @@ App.BackgroundOperationsController = Em.Controller.extend({
}.observes('isWorking'),
/**
- * Add new operations to <code>this.allOperations</code> variable
+ * Update info about background operations
+ * Put all tasks with command 'EXECUTE' into <code>executeTasks</code>, other tasks with it they are still running put into <code>runningTasks</code>
+ * Put all task that should be shown in popup modal window into <code>this.allOperations</code>
* @param data json loaded from server
*/
- updateBackgroundOperations : function(data){
+ updateBackgroundOperations: function (data) {
var runningTasks = [];
+ var executeTasks = this.get('executeTasks');
data.items.forEach(function (item) {
item.tasks.forEach(function (task) {
- if (task.Tasks.status == 'QUEUED' || task.Tasks.status == 'PENDING') {
- runningTasks.push(task.Tasks);
+ if (task.Tasks.command == 'EXECUTE') {
+ if (!executeTasks.someProperty('id', task.Tasks.id)) {
+ executeTasks.push(task.Tasks);
+ }
+ } else {
+ if (task.Tasks.status == 'QUEUED' || task.Tasks.status == 'PENDING' || task.Tasks.status == 'IN_PROGRESS') {
+ runningTasks.push(task.Tasks);
+ }
}
});
});
- runningTasks = runningTasks.sort(function(a,b){
+ for (var i = 0; i < executeTasks.length; i++) {
+ if (executeTasks[i].status == 'QUEUED' || executeTasks[i].status == 'PENDING' || executeTasks[i].status == 'IN_PROGRESS') {
+ var url = App.testMode ? '/data/background_operations/list_on_start.json' :
+ App.apiPrefix + '/clusters/' + App.router.getClusterName() + '/requests/' + executeTasks[i].request_id + '/tasks/' + executeTasks[i].id;
+ var j = i;
+ $.ajax({
+ type: "GET",
+ url: url,
+ dataType: 'json',
+ timeout: App.timeout,
+ success: function (data) {
+ if (data) {
+ executeTasks[j] = data.Tasks;
+ }
+ },
+ error: function () {
+ console.log('ERROR: error during executeTask update');
+ },
+
+ statusCode: require('data/statusCodes')
+ });
+ }
+ }
+ ;
+ var currentTasks;
+ currentTasks = runningTasks.concat(executeTasks);
+ currentTasks = currentTasks.sort(function (a, b) {
return a.id - b.id;
});
- var currentTasks = this.get('allOperations');
-
- runningTasks.forEach(function(item){
- var task = currentTasks.findProperty('id', item.id);
- if(task){
- currentTasks[currentTasks.indexOf(task)] = item;
- } else {
- currentTasks.pushObject(item);
+ this.get('allOperations').filterProperty('isOpen').mapProperty('id').forEach(function(id){
+ if (currentTasks.someProperty('id', id)) {
+ currentTasks.findProperty('id', id).isOpen = true;
}
});
- for(var i = currentTasks.length-1; i>=0; i--){
- var isTaskFinished = !runningTasks.someProperty('id', currentTasks[i].id);
- if(isTaskFinished){
- currentTasks.removeAt(i);
- }
- }
-
- this.set('allOperationsCount', currentTasks.length);
+ this.set('allOperations', currentTasks);
+ this.set('allOperationsCount', runningTasks.length + executeTasks.filterProperty('status', 'PENDING').length + executeTasks.filterProperty('status', 'QUEUED').length + executeTasks.filterProperty('status', 'IN_PROGRESS').length);
var eventsArray = this.get('eventsArray');
- if(eventsArray.length){
+ if (eventsArray.length) {
var itemsToRemove = [];
eventsArray.forEach(function(item){
@@ -190,6 +219,7 @@ App.BackgroundOperationsController = Em.Controller.extend({
* Onclick handler for background operations number located right to logo
*/
showPopup: function(){
+ this.set('executeTasks', []);
this.loadOperations();
App.ModalPopup.show({
headerClass: Ember.View.extend({
Oops, something went wrong.

0 comments on commit 9b15091

Please sign in to comment.