ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From maha...@apache.org
Subject [1/4] AMBARI-5934. Provide ability to rebalance HDFS.
Date Fri, 08 Aug 2014 17:10:38 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 70588f5e0 -> cb662f494


http://git-wip-us.apache.org/repos/asf/ambari/blob/cb662f49/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 1d5395e..da90e6e 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -294,6 +294,7 @@ Em.I18n.translations = {
   'host.spacesValidation': 'Can\'t contain whitespaces',
   'host.trimspacesValidation': 'Can\'t contain leading or trailing whitespaces',
 
+  'services.hdfs.rebalance.title' : 'HDFS Rebalance',
   'services.nagios.description':'Nagios Monitoring and Alerting system',
   'services.ganglia.description':'Ganglia Metrics Collection system',
   'services.hdfs.description':'Apache Hadoop Distributed File System',
@@ -1173,6 +1174,13 @@ Em.I18n.translations = {
   'services.service.summary.clientCount': '{0} Client Hosts',
   'services.service.summary.historyServer': 'History Server Web UI',
   'services.service.actions.run.rebalancer':'Run Rebalancer',
+  'services.service.actions.run.rebalanceHdfsNodes':'Run Rebalance HDFS nodes',
+  'services.service.actions.run.rebalanceHdfsNodes.title':'HDFS Rebalance NameNode',
+  'services.service.actions.run.rebalanceHdfsNodes.prompt':'Please enter Balancer treshold:',
+  'services.service.actions.run.rebalanceHdfsNodes.promptTooltip':'Percentage of disk capacity.
This overwrites the default threshold',
+  'services.service.actions.run.rebalanceHdfsNodes.promptError':'Value should be integer
between 0 and 100',
+  'services.service.actions.run.rebalanceHdfsNodes.context':'Rebalance HDFS nodes',
+  'services.service.actions.run.rebalanceHdfsNodes.error':'Error during remote command: ',
   'services.service.actions.run.yarnRefreshQueues.menu':'Refresh YARN Capacity Scheduler',
   'services.service.actions.run.yarnRefreshQueues.context':'Refresh YARN Capacity Scheduler',
   'services.service.actions.run.yarnRefreshQueues.error':'Error during remote command: ',

http://git-wip-us.apache.org/repos/asf/ambari/blob/cb662f49/ambari-web/app/templates/common/host_progress_popup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/host_progress_popup.hbs b/ambari-web/app/templates/common/host_progress_popup.hbs
index 26dcc6f..6b36344 100644
--- a/ambari-web/app/templates/common/host_progress_popup.hbs
+++ b/ambari-web/app/templates/common/host_progress_popup.hbs
@@ -193,7 +193,24 @@
         <div class="task-detail-log-info">
             <div class="content-area">
                 <div class="task-detail-log-clipboard-wrap"></div>
-                <div class="task-detail-log-maintext">
+                <div class="task-detail-log-maintext">  
+                    {{#if view.openedTask.isRebalanceHDFSTask }}
+                      <h5>{{t services.hdfs.rebalance.title}}</h5>
+                      <div class="progresspopup-rebalancehdfs">
+                        <div class="progress progress-striped active">
+                          <div class="bar" {{bindAttr style="view.openedTask.completionProgressStyle"}}></div>
+                        </div>
+                      </div>
+                      <div class="clearfix">
+                        <div class="pull-left">
+                          {{view.openedTask.dataMoved}} moved /
+                          {{view.openedTask.dataLeft}} left /
+                          {{view.openedTask.dataBeingMoved}} being processed
+                        </div>
+                        <button class="btn btn-danger pull-right" {{action stopRebalanceHDFS}}>{{t
common.cancel}}</button>
+                      </div>
+                      <hr>
+                    {{/if}}
                     <h5>stderr: &nbsp; <span class="muted">{{view.openedTask.errorLog}}
</span></h5>
                     <pre class="stderr">{{view.openedTask.stderr}}</pre>
                     <h5>stdout: &nbsp; <span class="muted"> {{view.openedTask.outputLog}}
</span></h5>

http://git-wip-us.apache.org/repos/asf/ambari/blob/cb662f49/ambari-web/app/templates/common/prompt_popup.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/common/prompt_popup.hbs b/ambari-web/app/templates/common/prompt_popup.hbs
index 6ca40a9..078cc65 100644
--- a/ambari-web/app/templates/common/prompt_popup.hbs
+++ b/ambari-web/app/templates/common/prompt_popup.hbs
@@ -17,11 +17,14 @@
 }}
 <div class="prompt-popup">
   <form>
-    <div class="control-group">
+    <div {{bindAttr class=":control-group view.parentView.isInvalid:error"}}>
       <label class="control-label">{{view.text}}</label>
       <div class="controls">
         {{view Em.TextField class="prompt-input" valueBinding="view.parentView.inputValue"}}
       </div>
+      {{#if view.parentView.isInvalid}}
+        <span class="help-inline">{{view.parentView.errorMessage}}</span>
+      {{/if}}
     </div>
   </form>
 </div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/cb662f49/ambari-web/app/utils/ajax/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax/ajax.js b/ambari-web/app/utils/ajax/ajax.js
index 17c74b0..c5f2252 100644
--- a/ambari-web/app/utils/ajax/ajax.js
+++ b/ambari-web/app/utils/ajax/ajax.js
@@ -302,6 +302,55 @@ var urls = {
       };
     }
   },
+  'service.item.rebalanceHdfsNodes' : {
+    'real' : '/clusters/{clusterName}/requests',
+    'mock' : '',
+    'format' : function(data) {
+      return {
+        type : 'POST',
+        data : JSON.stringify({
+          RequestInfo : {
+            'context' : Em.I18n.t('services.service.actions.run.rebalanceHdfsNodes.context'),
+            'command' : 'REBALANCEHDFS',
+            'namenode' : JSON.stringify({threshold: data.threshold})
+          },
+          "Requests/resource_filters" : [ {
+            'service_name' : 'HDFS',
+            'component_name' : 'NAMENODE',
+            'hosts' : data.hosts
+          } ]
+        })
+      }
+    }
+  },
+  
+  'cancel.background.operation' : {
+    'real' : '/clusters/{clusterName}/requests',
+    'mock' : '',
+    'format' : function(data) {
+      return {
+        type : 'POST',
+        data : JSON.stringify({
+          RequestInfo : {
+            'context' : 'Cancel background operation',
+            'action'  : 'cancel_background_task',
+            "parameters" : {
+              "cancel_policy"   : "SIGKILL",
+              'before_system_hook_function' : 'fetch_bg_pid_by_taskid',
+              "cancel_task_id"  : data.cancelTaskId
+            }
+          },
+          "Requests/resource_filters" : [ {
+            "service_name" : data.serviceName,
+            "component_name" : data.componentName,
+            'hosts' : data.hosts
+          } ]
+        })
+      }
+    }
+  },
+
+
   'service.item.refreshQueueYarnRequest':{
     'real': '/clusters/{clusterName}/requests',
     'mock': '',
@@ -319,6 +368,7 @@ var urls = {
         }
       }
   },
+
   'service.load_config_groups': {
     'real': '/clusters/{clusterName}/config_groups?ConfigGroup/tag={serviceName}&fields=*',
     'mock': '/data/configurations/config_group.json'

http://git-wip-us.apache.org/repos/asf/ambari/blob/cb662f49/ambari-web/app/utils/helper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/helper.js b/ambari-web/app/utils/helper.js
index a86a42d..5b8899c 100644
--- a/ambari-web/app/utils/helper.js
+++ b/ambari-web/app/utils/helper.js
@@ -434,6 +434,9 @@ App.format = {
     if (result === ' Nagios Update Ignore Actionexecute') {
        result = Em.I18n.t('common.maintenance.task');
     }
+    if (result === 'Rebalancehdfs NameNode') {
+       result = Em.I18n.t('services.service.actions.run.rebalanceHdfsNodes.title');
+    }
     return result;
   },
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/cb662f49/ambari-web/app/utils/host_progress_popup.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/host_progress_popup.js b/ambari-web/app/utils/host_progress_popup.js
index 529b8bb..d258a12 100644
--- a/ambari-web/app/utils/host_progress_popup.js
+++ b/ambari-web/app/utils/host_progress_popup.js
@@ -380,6 +380,23 @@ App.HostPopup = Em.Object.create({
                   existTask.set('errorLog', _task.Tasks.error_log);
                   existTask.set('startTime', date.startTime(_task.Tasks.start_time));
                   existTask.set('duration', date.durationSummary(_task.Tasks.start_time,
_task.Tasks.end_time));
+                  // Puts some command information to render it 
+                  var isRebalanceHDFSTask = (_task.Tasks.command === 'CUSTOM_COMMAND' &&
_task.Tasks.custom_command_name === 'REBALANCEHDFS');
+                  existTask.set('isRebalanceHDFSTask', isRebalanceHDFSTask);
+                  if(isRebalanceHDFSTask){
+                    var structuredOut = _task.Tasks.structured_out;
+                    if (!structuredOut || structuredOut === 'null') {
+                      structuredOut = {};
+                    }
+                    
+                    existTask.set('dataMoved', structuredOut['dataMoved'] || '0');
+                    existTask.set('dataLeft', structuredOut['dataLeft'] || '0');
+                    existTask.set('dataBeingMoved', structuredOut['dataBeingMoved'] || '0');
+                    existTask.set('completionProgressStyle', 'width:' + (structuredOut['completePercent']
|| 0) * 100 + '%;');
+
+                    existTask.set('command', _task.Tasks.command);
+                    existTask.set('custom_command_name', _task.Tasks.custom_command_name);
+                  }
                 } else {
                   existTasks.pushObject(this.createTask(_task));
                 }
@@ -917,7 +934,25 @@ App.HostPopup = Em.Object.create({
           $(".modal").scrollTop(0);
           $(".modal-body").scrollTop(0);
         },
-
+        
+        stopRebalanceHDFS: function () {
+          var hostPopup = this;
+          return App.showConfirmationPopup(function () {
+          App.ajax.send({
+            name : 'cancel.background.operation',
+              sender : hostPopup,
+            data : {
+                cancelTaskId : hostPopup.get('openedTaskId'),
+              command : "REFRESHQUEUES",
+              context : Em.I18n.t('services.service.actions.run.yarnRefreshQueues.context')
,
+              hosts : App.Service.find('HDFS').get('hostComponents').findProperty('componentName',
'NAMENODE').get('hostName'),
+              serviceName : "HDFS",
+              componentName : "NAMENODE"
+            }
+          });
+            hostPopup.backToServiceList();
+          });
+        },
         /**
          * Onclick handler for selected Task
          */

http://git-wip-us.apache.org/repos/asf/ambari/blob/cb662f49/ambari-web/app/views/common/modal_popup.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/modal_popup.js b/ambari-web/app/views/common/modal_popup.js
index 82cdf2b..223a77a 100644
--- a/ambari-web/app/views/common/modal_popup.js
+++ b/ambari-web/app/views/common/modal_popup.js
@@ -260,6 +260,8 @@ App.showPromptPopup = function (text, primary, defaultValue, secondary)
{
       text: text
     }),
     inputValue: defaultValue || '',
+    isInvalid: false,
+    errorMessage: '',
     onPrimary: function () {
       this.hide();
       primary(this.get('inputValue'));

http://git-wip-us.apache.org/repos/asf/ambari/blob/cb662f49/ambari-web/app/views/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/item.js b/ambari-web/app/views/main/service/item.js
index badd94f..6e9108a 100644
--- a/ambari-web/app/views/main/service/item.js
+++ b/ambari-web/app/views/main/service/item.js
@@ -92,6 +92,13 @@ App.MainServiceItemView = Em.View.extend({
         label: Em.I18n.t('services.service.actions.reassign.master'),
         cssClass: 'icon-share-alt',
         disabled: false
+      },
+      REBALANCE_HDFS: {
+        action: 'rebalanceHdfsNodes',
+        context: Em.I18n.t('services.service.actions.run.rebalanceHdfsNodes.context'),
+        label: Em.I18n.t('services.service.actions.run.rebalanceHdfsNodes'),
+        cssClass: 'icon-refresh',
+        disabled: false
       }
     }
   },
@@ -181,8 +188,10 @@ App.MainServiceItemView = Em.View.extend({
         options.push(actionMap.RUN_SMOKE_TEST);
       }
       options.push(actionMap.TOGGLE_PASSIVE);
-
       var serviceName = service.get('serviceName');
+      if (serviceName === 'HDFS') {
+        options.push(actionMap.REBALANCE_HDFS);
+      }
       self.addActionMap().filterProperty('service', serviceName).forEach(function(item) {
         item.action = 'add' + item.component;
         item.disabled = self.get('controller.isAddDisabled-' + item.component);


Mime
View raw message