You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ak...@apache.org on 2016/06/17 17:16:15 UTC

[3/3] ambari git commit: AMBARI-17293 Ambari does not refresh yarn queues when HiveServerIntearctive component is restarted (akovalenko)

AMBARI-17293 Ambari does not refresh yarn queues when HiveServerIntearctive component is restarted (akovalenko)


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

Branch: refs/heads/trunk
Commit: ae9f76f1319300ec7486198f47f5dbeffba980c8
Parents: da8195f
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Fri Jun 17 16:11:25 2016 +0300
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Fri Jun 17 20:15:14 2016 +0300

----------------------------------------------------------------------
 ambari-web/app/controllers/main/host/details.js | 69 +++++++++++++++++++-
 .../test/controllers/main/host/details_test.js  | 13 ++++
 2 files changed, 81 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ae9f76f1/ambari-web/app/controllers/main/host/details.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js
index 1364adf..517adb2 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -68,6 +68,12 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
   isOozieServerAddable: true,
 
   /**
+   * List of components to run refresh YARN queue with
+   * @type {Array}
+   */
+  refreshYARNQueueComponents: ['HIVE_SERVER_INTERACTIVE'],
+
+  /**
    * Open dashboard page
    * @method routeHome
    */
@@ -510,13 +516,18 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
    * @method restartComponent
    */
   restartComponent: function (event) {
+    var self = this;
     var component = event.context;
-    if (event.context.get('componentName') == 'NAMENODE') {
+    if (component.get('componentName') == 'NAMENODE') {
       this.checkNnLastCheckpointTime(function () {
         return App.showConfirmationPopup(function () {
           batchUtils.restartHostComponents([component], Em.I18n.t('rollingrestart.context.selectedComponentOnSelectedHost').format(component.get('displayName')), "HOST_COMPONENT");
         });
       });
+    } else if (this.get('refreshYARNQueueComponents').contains(component.get('componentName'))) {
+      return App.showConfirmationPopup(function () {
+        self.restartComponentAndRefreshYARNQueue(component);
+      });
     } else {
       return App.showConfirmationPopup(function () {
         batchUtils.restartHostComponents([component], Em.I18n.t('rollingrestart.context.selectedComponentOnSelectedHost').format(component.get('displayName')), "HOST_COMPONENT");
@@ -524,6 +535,62 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
     }
   },
 
+  restartComponentAndRefreshYARNQueue: function (component) {
+    var componentToRestartHost = App.HostComponent.find().findProperty('componentName', component.get('componentName')).get('hostName');
+    var resourceManagerHost = App.HostComponent.find().findProperty('componentName', 'RESOURCEMANAGER').get('hostName');
+    var batches = [
+      {
+        "order_id": 1,
+        "type": "POST",
+        "uri": App.apiPrefix + "/clusters/" + App.get('clusterName') + "/requests",
+        "RequestBodyInfo": {
+          "RequestInfo": {
+            "context": "Restart " + component.get('displayName'),
+            "command": "RESTART",
+            "operation_level": {
+              "level": "HOST_COMPONENT",
+              "cluster_name": App.get('clusterName'),
+              "service_name": component.get('service.serviceName'),
+              "hostcomponent_name": component.get('componentName')
+            }
+          },
+          "Requests/resource_filters": [{
+            "service_name": component.get('service.serviceName'),
+            "component_name": component.get('componentName'),
+            "hosts": componentToRestartHost
+          }]
+        }
+      },
+      {
+        "order_id": 2,
+        "type": "POST",
+        "uri": App.apiPrefix + "/clusters/" + App.get('clusterName') + "/requests",
+        "RequestBodyInfo": {
+          "RequestInfo": {
+            "context": "Refresh YARN Capacity Scheduler",
+            "command": "REFRESHQUEUES",
+            "parameters/forceRefreshConfigTags": "capacity-scheduler"
+          },
+          "Requests/resource_filters": [{
+            "service_name": "YARN",
+            "component_name": "RESOURCEMANAGER",
+            "hosts": resourceManagerHost
+          }]
+        }
+      }
+    ];
+    App.ajax.send({
+      name: 'common.batch.request_schedules',
+      sender: this,
+      data: {
+        intervalTimeSeconds: 1,
+        tolerateSize: 0,
+        batches: batches
+      },
+      success: 'showBackgroundOperationsPopup'
+    });
+  },
+
   /**
    * add component as <code>addComponent<code> method but perform
    * kdc sessionstate if cluster is secure;

http://git-wip-us.apache.org/repos/asf/ambari/blob/ae9f76f1/ambari-web/test/controllers/main/host/details_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/host/details_test.js b/ambari-web/test/controllers/main/host/details_test.js
index 66bd454..971d0cd 100644
--- a/ambari-web/test/controllers/main/host/details_test.js
+++ b/ambari-web/test/controllers/main/host/details_test.js
@@ -472,11 +472,13 @@ describe('App.MainHostDetailsController', function () {
       sinon.spy(App, "showConfirmationPopup");
       sinon.stub(batchUtils, "restartHostComponents", Em.K);
       sinon.stub(controller, 'checkNnLastCheckpointTime', Em.clb);
+      sinon.stub(controller, "restartComponentAndRefreshYARNQueue", Em.K);
     });
     afterEach(function () {
       App.showConfirmationPopup.restore();
       batchUtils.restartHostComponents.restore();
       controller.checkNnLastCheckpointTime.restore();
+      controller.restartComponentAndRefreshYARNQueue.restore();
     });
 
     it('popup should be displayed', function () {
@@ -497,6 +499,17 @@ describe('App.MainHostDetailsController', function () {
       expect(controller.checkNnLastCheckpointTime.calledOnce).to.equal(true);
       expect(App.showConfirmationPopup.calledOnce).to.be.true;
     });
+
+    it('restart HIVE_SERVER_INTERACTIVE, should call restartComponentAndRefreshYARNQueuet', function () {
+      var event = {
+        context: Em.Object.create({
+          componentName: 'HIVE_SERVER_INTERACTIVE'
+        })
+      };
+      var confirmPopup = controller.restartComponent(event);
+      confirmPopup.onPrimary();
+      expect(controller.restartComponentAndRefreshYARNQueue.calledOnce).to.be.true;
+    });
   });
 
   describe('#addComponent()', function () {