You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ja...@apache.org on 2016/03/23 23:44:04 UTC

ambari git commit: AMBARI-15539. YARN Queue should be refreshed when enabling/disabling Interactive Query. (Jaimin)

Repository: ambari
Updated Branches:
  refs/heads/trunk 476d87b70 -> 1fbf7f15d


AMBARI-15539. YARN Queue should be refreshed when enabling/disabling Interactive Query. (Jaimin)


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

Branch: refs/heads/trunk
Commit: 1fbf7f15d9d25ef592bca07fd11d7b63b3b48b0f
Parents: 476d87b
Author: Jaimin Jetly <ja...@hortonworks.com>
Authored: Wed Mar 23 15:42:46 2016 -0700
Committer: Jaimin Jetly <ja...@hortonworks.com>
Committed: Wed Mar 23 15:42:55 2016 -0700

----------------------------------------------------------------------
 .../configs/component_actions_by_configs.js     | 70 ++++++++++++++++----
 1 file changed, 57 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1fbf7f15/ambari-web/app/mixins/main/service/configs/component_actions_by_configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/main/service/configs/component_actions_by_configs.js b/ambari-web/app/mixins/main/service/configs/component_actions_by_configs.js
index 7857411..9909fd4 100644
--- a/ambari-web/app/mixins/main/service/configs/component_actions_by_configs.js
+++ b/ambari-web/app/mixins/main/service/configs/component_actions_by_configs.js
@@ -57,12 +57,16 @@ App.ComponentActionsByConfigs = Em.Mixin.create({
       componentsToDelete.forEach(function(_componentToDelete){
         var displayName = App.StackServiceComponent.find().findProperty('componentName',  _componentToDelete.componentName).get('displayName');
         var context = Em.I18n.t('requestInfo.stop').format(displayName);
-        this.installHostComponents( _componentToDelete.hostName, _componentToDelete.componentName, context).done(function(data){
+        self.refreshYarnQueues().done(function(data) {
           self.isRequestCompleted(data).done(function() {
-            self.deleteHostComponent(_componentToDelete.hostName, _componentToDelete.componentName);
+            self.installHostComponents( _componentToDelete.hostName, _componentToDelete.componentName, context).done(function(data){
+              self.isRequestCompleted(data).done(function() {
+                self.deleteHostComponent(_componentToDelete.hostName, _componentToDelete.componentName);
+              });
+            });
           });
         });
-      }, this);
+      }, self);
     }
   },
 
@@ -99,22 +103,26 @@ App.ComponentActionsByConfigs = Em.Mixin.create({
       }, this);
       var allComponentsToAdd = componentsToAdd.concat(dependentComponents);
       var allComponentsToAddHosts = allComponentsToAdd.mapProperty('hostName').uniq();
-      allComponentsToAddHosts.forEach(function(_hostName, index){
+      allComponentsToAddHosts.forEach(function(_hostName){
         var hostComponents = allComponentsToAdd.filterProperty('hostName', _hostName).mapProperty('componentName').uniq();
         var masterHostComponents =  allComponentsToAdd.filterProperty('hostName', _hostName).filterProperty('isClient', false).mapProperty('componentName').uniq();
-        this.createHostComponents(_hostName, hostComponents).done(function(data){
-          self.installHostComponents(_hostName, hostComponents).done(function(data){
-            self.isRequestCompleted(data).done(function() {
-              var displayNames = masterHostComponents.map(function(item) {
-                return App.StackServiceComponent.find().findProperty('componentName', item).get('displayName');
+        self.refreshYarnQueues().done(function(data) {
+          self.isRequestCompleted(data).done(function() {
+            self.createHostComponents(_hostName, hostComponents).done(function() {
+              self.installHostComponents(_hostName, hostComponents).done(function(data){
+                self.isRequestCompleted(data).done(function() {
+                  var displayNames = masterHostComponents.map(function(item) {
+                    return App.StackServiceComponent.find().findProperty('componentName', item).get('displayName');
+                  });
+                  var displayStr =  stringUtils.getFormattedStringFromArray(displayNames);
+                  var context = Em.I18n.t('requestInfo.start').format(displayStr);
+                  self.startHostComponents(_hostName, masterHostComponents, context);
+                });
               });
-              var displayStr =  stringUtils.getFormattedStringFromArray(displayNames);
-              var context = Em.I18n.t('requestInfo.start').format(displayStr);
-              self.startHostComponents(_hostName, masterHostComponents, context);
             });
           });
         });
-      }, this);
+      }, self);
     }
   },
 
@@ -215,6 +223,42 @@ App.ComponentActionsByConfigs = Em.Mixin.create({
   },
 
   /**
+   * Calls the API to refresh yarn queue
+   * @private
+   * @method {refreshYarnQueues}
+   * @return {Object} Deferred
+   */
+  refreshYarnQueues: function () {
+    var dfd = $.Deferred();
+    var capacitySchedulerConfigs = this.get('allConfigs').filterProperty('filename', 'capacity-scheduler.xml').filter(function(item){
+      return item.get('value') !== item.get('initialValue');
+    });
+
+    if (capacitySchedulerConfigs.length) {
+      var serviceName = 'YARN';
+      var componentName = 'RESOURCEMANAGER';
+      var commandName = 'REFRESHQUEUES';
+      var tag = 'capacity-scheduler';
+      var hosts = App.Service.find(serviceName).get('hostComponents').filterProperty('componentName', componentName).mapProperty('hostName');
+      return App.ajax.send({
+        name : 'service.item.refreshQueueYarnRequest',
+        sender: this,
+        data : {
+          command : commandName,
+          context : Em.I18n.t('services.service.actions.run.yarnRefreshQueues.context') ,
+          hosts : hosts.join(','),
+          serviceName : serviceName,
+          componentName : componentName,
+          forceRefreshConfigTags : tag
+        }
+      });
+    } else {
+      dfd.resolve();
+    }
+    return dfd.promise();
+  },
+
+  /**
    * Fetched the Request Id to poll and starts the polling to check
    * if the request is ongoing or completed until deferred is resolved
    * @param data {Object} Json