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

[01/22] ambari git commit: AMBARI-20718.User should not be allowed to validate/Submit the workflow in case of duplicate action nodes(Venkata Sairam via padmapriyanitt)

Repository: ambari
Updated Branches:
  refs/heads/branch-3.0-perf 8de3961b6 -> 2f20b2ed2


AMBARI-20718.User should not be allowed to validate/Submit the workflow in case of duplicate action nodes(Venkata Sairam via padmapriyanitt)


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

Branch: refs/heads/branch-3.0-perf
Commit: 73eff1215c6d99b618dfdd545a039aeab63135ff
Parents: 36e456b
Author: padmapriyanitt <pa...@gmail.com>
Authored: Tue Apr 11 15:40:47 2017 +0530
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Tue Apr 11 14:14:12 2017 +0300

----------------------------------------------------------------------
 .../src/main/resources/ui/app/components/flow-designer.js     | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/73eff121/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
index e3f3718..17f21ee 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
@@ -723,10 +723,9 @@ export default Ember.Component.extend(FindNodeMixin, Validations, {
   },
   openJobConfig () {
     this.get('workflowContext').clearErrors();
-    var workflowGenerator=WorkflowGenerator.create({workflow:this.get("workflow"),
-    workflowContext:this.get('workflowContext')});
-    var workflowXml=workflowGenerator.process();
-    if(this.get('workflowContext').hasErrors()){
+    var workflowGenerator = WorkflowGenerator.create({workflow:this.get("workflow"), workflowContext:this.get('workflowContext')});
+    var workflowXml = workflowGenerator.process();
+    if(this.get('workflowContext').hasErrors() || (this.get("validationErrors") && this.get("validationErrors").length)){
       this.set('errors',this.get('workflowContext').getErrors());
     }else{
       var dynamicProperties = this.get('propertyExtractor').getDynamicProperties(workflowXml);


[12/22] ambari git commit: AMBARI-20724 Merge calls to server which fetch ambari properties. (atkach)

Posted by ao...@apache.org.
AMBARI-20724 Merge calls to server which fetch ambari properties. (atkach)


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

Branch: refs/heads/branch-3.0-perf
Commit: e3794a3a5d02367b0b3d0a052b29a861196f602c
Parents: 4bc4942
Author: Andrii Tkach <at...@apache.org>
Authored: Mon Apr 10 17:52:43 2017 +0300
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Tue Apr 11 14:14:12 2017 +0300

----------------------------------------------------------------------
 .../controllers/global/cluster_controller.js    | 31 ++-------
 ambari-web/app/controllers/main.js              | 28 +-------
 ambari-web/app/routes/main.js                   | 32 ++++-----
 .../global/cluster_controller_test.js           | 73 ++++++--------------
 ambari-web/test/controllers/main_test.js        | 66 ------------------
 5 files changed, 45 insertions(+), 185 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e3794a3a/ambari-web/app/controllers/global/cluster_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/global/cluster_controller.js b/ambari-web/app/controllers/global/cluster_controller.js
index b24219e..29c979e 100644
--- a/ambari-web/app/controllers/global/cluster_controller.js
+++ b/ambari-web/app/controllers/global/cluster_controller.js
@@ -142,30 +142,7 @@ App.ClusterController = Em.Controller.extend(App.ReloadPopupMixin, {
     }
   },
 
-  /**
-   * load current server clock in milli-seconds
-   */
-  loadClientServerClockDistance: function () {
-    var dfd = $.Deferred();
-    this.getServerClock().done(function () {
-      dfd.resolve();
-    });
-    return dfd.promise();
-  },
-
-  getServerClock: function () {
-    return App.ajax.send({
-      name: 'ambari.service',
-      sender: this,
-      data: {
-        fields: '?fields=RootServiceComponents/server_clock'
-      },
-      success: 'getServerClockSuccessCallback',
-      error: 'getServerClockErrorCallback'
-    });
-  },
-
-  getServerClockSuccessCallback: function (data) {
+  setServerClock: function (data) {
     var clientClock = new Date().getTime();
     var serverClock = (data.RootServiceComponents.server_clock).toString();
     serverClock = serverClock.length < 13 ? serverClock + '000' : serverClock;
@@ -185,7 +162,6 @@ App.ClusterController = Em.Controller.extend(App.ReloadPopupMixin, {
   loadClusterData: function () {
     this.loadAuthorizations();
     this.getAllHostNames();
-    this.loadAmbariProperties();
 
     if (!App.get('clusterName')) {
       return;
@@ -441,10 +417,13 @@ App.ClusterController = Em.Controller.extend(App.ReloadPopupMixin, {
   },
 
   loadAmbariPropertiesSuccess: function (data) {
+    var mainController = App.router.get('mainController');
     this.set('ambariProperties', data.RootServiceComponents.properties);
     // Absence of 'jdk.name' and 'jce.name' properties says that ambari configured with custom jdk.
     this.set('isCustomJDK', App.isEmptyObject(App.permit(data.RootServiceComponents.properties, ['jdk.name', 'jce.name'])));
-    App.router.get('mainController').monitorInactivity();
+    this.setServerClock(data);
+    mainController.setAmbariServerVersion.call(mainController, data);
+    mainController.monitorInactivity();
   },
 
   loadAmbariPropertiesError: Em.K,

http://git-wip-us.apache.org/repos/asf/ambari/blob/e3794a3a/ambari-web/app/controllers/main.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main.js b/ambari-web/app/controllers/main.js
index 798115f..499df74 100644
--- a/ambari-web/app/controllers/main.js
+++ b/ambari-web/app/controllers/main.js
@@ -123,42 +123,18 @@ App.MainController = Em.Controller.extend({
     );
   }.observes("App.router.location.lastSetURL", "App.clusterStatus.isInstalled"),
 
-  /**
-   * check server version and web client version
-   */
-  checkServerClientVersion: function () {
-    var dfd = $.Deferred();
-    var self = this;
-    self.getServerVersion().done(function () {
-      dfd.resolve();
-    });
-    return dfd.promise();
-  },
-  getServerVersion: function(){
-    return App.ajax.send({
-      name: 'ambari.service',
-      sender: this,
-      data: {
-        fields: '?fields=RootServiceComponents/component_version,RootServiceComponents/properties/server.os_family&minimal_response=true'
-      },
-      success: 'getServerVersionSuccessCallback',
-      error: 'getServerVersionErrorCallback'
-    });
-  },
-  getServerVersionSuccessCallback: function (data) {
+  setAmbariServerVersion: function (data) {
     var clientVersion = App.get('version');
     var serverVersion = (data.RootServiceComponents.component_version).toString();
     this.set('ambariServerVersion', serverVersion);
     if (clientVersion) {
       this.set('versionConflictAlertBody', Em.I18n.t('app.versionMismatchAlert.body').format(serverVersion, clientVersion));
-      this.set('isServerClientVersionMismatch', clientVersion != serverVersion);
+      this.set('isServerClientVersionMismatch', clientVersion !== serverVersion);
     } else {
       this.set('isServerClientVersionMismatch', false);
     }
     App.set('isManagedMySQLForHiveEnabled', App.config.isManagedMySQLForHiveAllowed(data.RootServiceComponents.properties['server.os_family']));
   },
-  getServerVersionErrorCallback: function () {
-  },
 
   monitorInactivity: function() {
     var timeout = Number(App.router.get('clusterController.ambariProperties')['user.inactivity.timeout.default']);

http://git-wip-us.apache.org/repos/asf/ambari/blob/e3794a3a/ambari-web/app/routes/main.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/main.js b/ambari-web/app/routes/main.js
index 88776b3..0a2375e 100644
--- a/ambari-web/app/routes/main.js
+++ b/ambari-web/app/routes/main.js
@@ -30,31 +30,31 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
     App.db.updateStorage();
     var self = this;
     var location = router.location.location.hash;
+    var clusterController = App.router.get('clusterController');
+
     router.getAuthenticated().done(function (loggedIn) {
       if (loggedIn) {
         var applicationController = App.router.get('applicationController');
         App.router.get('experimentalController').loadSupports().complete(function () {
           applicationController.startKeepAlivePoller();
-          App.router.get('mainController').checkServerClientVersion().done(function () {
+          clusterController.loadAmbariProperties().complete(function () {
             App.router.get('mainViewsController').loadAmbariViews();
-            App.router.get('clusterController').loadClusterName(false).done(function () {
+            clusterController.loadClusterName(false).done(function () {
               if (App.get('testMode')) {
                 router.get('mainController').initialize();
               } else {
                 if (router.get('clusterInstallCompleted')) {
-                  App.router.get('clusterController').loadClientServerClockDistance().done(function () {
-                    if (!App.get('isOnlyViewUser')) {
-                      App.router.get('clusterController').checkDetailedRepoVersion().done(function () {
-                        router.get('mainController').initialize();
-                      });
-                    } else {
-                      // Don't transit to Views when user already on View page
-                      if (App.router.currentState.name !== 'viewDetails') {
-                        App.router.transitionTo('main.views.index');
-                      }
-                      App.router.get('clusterController').set('isLoaded', true); // hide loading bar
+                  if (!App.get('isOnlyViewUser')) {
+                    clusterController.checkDetailedRepoVersion().done(function () {
+                      router.get('mainController').initialize();
+                    });
+                  } else {
+                    // Don't transit to Views when user already on View page
+                    if (App.router.currentState.name !== 'viewDetails') {
+                      App.router.transitionTo('main.views.index');
                     }
-                  });
+                    clusterController.set('isLoaded', true); // hide loading bar
+                  }
                 }
                 else {
                   Em.run.next(function () {
@@ -65,13 +65,13 @@ module.exports = Em.Route.extend(App.RouterRedirections, {
                         if (App.isAuthorized('AMBARI.ADD_DELETE_CLUSTERS')) {
                           self.redirectToInstaller(router, currentClusterStatus, false);
                         } else {
-                          App.router.get('clusterController').set('isLoaded', true);
+                          clusterController.set('isLoaded', true);
                           Em.run.next(function () {
                             App.router.transitionTo('main.views.index');
                           });
                         }
                       } else {
-                        App.router.get('clusterController').set('isLoaded', true);
+                        clusterController.set('isLoaded', true);
                       }
                     });
                   });

http://git-wip-us.apache.org/repos/asf/ambari/blob/e3794a3a/ambari-web/test/controllers/global/cluster_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/global/cluster_controller_test.js b/ambari-web/test/controllers/global/cluster_controller_test.js
index e7b71f9..170ed78 100644
--- a/ambari-web/test/controllers/global/cluster_controller_test.js
+++ b/ambari-web/test/controllers/global/cluster_controller_test.js
@@ -134,7 +134,7 @@ describe('App.clusterController', function () {
     });
   });
 
-  describe('#getServerClockSuccessCallback()', function () {
+  describe('#setServerClock()', function () {
     var testCases = [
       {
         title: 'if server clock is 1 then currentServerTime should be 1000',
@@ -178,7 +178,7 @@ describe('App.clusterController', function () {
 
     testCases.forEach(function (test) {
       it(test.title, function () {
-        controller.getServerClockSuccessCallback(test.data);
+        controller.setServerClock(test.data);
         expect(App.get('currentServerTime')).to.equal(test.result);
         App.set('clockDistance', clockDistance);
         App.set('currentServerTime', currentServerTime);
@@ -572,41 +572,6 @@ describe('App.clusterController', function () {
     });
   });
 
-  describe('#loadClientServerClockDistance()', function() {
-
-    beforeEach(function() {
-      sinon.stub(controller, 'getServerClock').returns({
-        done: Em.clb
-      });
-    });
-
-    afterEach(function() {
-      controller.getServerClock.restore();
-    });
-
-    it('getServerClock should be called', function() {
-      expect(controller.loadClientServerClockDistance()).to.be.an.object;
-      expect(controller.getServerClock).to.be.calledOnce;
-    });
-  });
-
-  describe('#getServerClock()', function() {
-
-    it('App.ajax.send should be called', function() {
-      controller.getServerClock();
-      var args = testHelpers.findAjaxRequest('name', 'ambari.service');
-      expect(args[0]).to.eql({
-        name: 'ambari.service',
-        sender: controller,
-        data: {
-          fields: '?fields=RootServiceComponents/server_clock'
-        },
-        success: 'getServerClockSuccessCallback',
-        error: 'getServerClockErrorCallback'
-      });
-    });
-  });
-
   describe('#isRunningState()', function() {
     var testCases = [
       {
@@ -738,20 +703,25 @@ describe('App.clusterController', function () {
   });
 
   describe('#loadAmbariPropertiesSuccess()', function() {
+    var data = {
+      RootServiceComponents: {
+        properties: {
+          p1: '1'
+        }
+      }
+    };
 
     beforeEach(function() {
       sinon.stub(App.router.get('mainController'), 'monitorInactivity');
-      controller.loadAmbariPropertiesSuccess({
-        RootServiceComponents: {
-          properties: {
-            p1: '1'
-          }
-        }
-      });
+      sinon.stub(App.router.get('mainController'), 'setAmbariServerVersion');
+      sinon.stub(controller, 'setServerClock');
+      controller.loadAmbariPropertiesSuccess(data);
     });
 
     afterEach(function() {
       App.router.get('mainController').monitorInactivity.restore();
+      App.router.get('mainController').setAmbariServerVersion.restore();
+      controller.setServerClock.restore();
     });
 
     it('should set ambariProperties', function() {
@@ -765,6 +735,14 @@ describe('App.clusterController', function () {
     it('monitorInactivity should be called', function() {
       expect(App.router.get('mainController').monitorInactivity).to.be.calledOnce;
     });
+
+    it('setAmbariServerVersion should be called', function() {
+      expect(App.router.get('mainController').setAmbariServerVersion.calledWith(data)).to.be.true;
+    });
+
+    it('setServerClock should be called', function() {
+      expect(controller.setServerClock.calledWith(data)).to.be.true;
+    });
   });
 
   describe('#updateClusterData()', function() {
@@ -849,7 +827,6 @@ describe('App.clusterController', function () {
     beforeEach(function() {
       sinon.stub(controller, 'loadAuthorizations');
       sinon.stub(controller, 'getAllHostNames');
-      sinon.stub(controller, 'loadAmbariProperties');
       sinon.stub(controller, 'loadClusterInfo');
       sinon.stub(controller, 'restoreUpgradeState');
       sinon.stub(controller, 'loadClusterDataToModel');
@@ -871,7 +848,6 @@ describe('App.clusterController', function () {
       App.router.get('mainController').startPolling.restore();
       controller.loadAuthorizations.restore();
       controller.getAllHostNames.restore();
-      controller.loadAmbariProperties.restore();
       controller.loadClusterInfo.restore();
       controller.restoreUpgradeState.restore();
       controller.loadClusterDataToModel.restore();
@@ -887,11 +863,6 @@ describe('App.clusterController', function () {
       expect(controller.getAllHostNames.calledOnce).to.be.true;
     });
 
-    it('loadAmbariProperties should be called', function() {
-      controller.loadClusterData();
-      expect(controller.loadAmbariProperties.calledOnce).to.be.true;
-    });
-
     it('getAllUserSettings should be called', function() {
       controller.loadClusterData();
       expect(App.router.get('userSettingsController').getAllUserSettings.calledOnce).to.be.true;

http://git-wip-us.apache.org/repos/asf/ambari/blob/e3794a3a/ambari-web/test/controllers/main_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main_test.js b/ambari-web/test/controllers/main_test.js
index c026604..9673092 100644
--- a/ambari-web/test/controllers/main_test.js
+++ b/ambari-web/test/controllers/main_test.js
@@ -22,40 +22,6 @@ var testHelpers = require('test/helpers');
 describe('App.MainController', function () {
   var mainController = App.MainController.create();
 
-  describe('#getServerVersionSuccessCallback', function () {
-
-    var controller = App.MainController.create(),
-      cases = [
-        {
-          osFamily: 'redhat5',
-          expected: false
-        },
-        {
-          osFamily: 'redhat6',
-          expected: true
-        },
-        {
-          osFamily: 'suse11',
-          expected: false
-        }
-      ],
-      title = 'App.isManagedMySQLForHiveEnabled should be {0} for {1}';
-
-    cases.forEach(function (item) {
-      it(title.format(item.expected, item.osFamily), function () {
-        controller.getServerVersionSuccessCallback({
-          'RootServiceComponents': {
-            'component_version': '',
-            'properties': {
-              'server.os_family': item.osFamily
-            }
-          }
-        });
-        expect(App.get('isManagedMySQLForHiveEnabled')).to.equal(item.expected);
-      });
-    });
-  });
-
   App.TestAliases.testAsComputedAlias(mainController, 'isClusterDataLoaded', 'App.router.clusterController.isLoaded', 'boolean');
 
   App.TestAliases.testAsComputedAlias(mainController, 'clusterDataLoadedPercent', 'App.router.clusterController.clusterDataLoadedPercent', 'string');
@@ -110,38 +76,6 @@ describe('App.MainController', function () {
     });
   });
 
-  describe('#checkServerClientVersion', function() {
-    beforeEach(function () {
-      sinon.stub(mainController, 'getServerVersion').returns({
-        done: function(func) {
-          if (func) {
-            func();
-          }
-        }
-      });
-    });
-    afterEach(function () {
-      mainController.getServerVersion.restore();
-    });
-    it ('Should resolve promise', function() {
-      var deffer = mainController.checkServerClientVersion();
-      deffer.then(function(val){
-        expect(val).to.be.undefined;
-      });
-    });
-  });
-
-  describe('#getServerVersion', function() {
-
-    it ('Should send data', function() {
-      mainController.getServerVersion();
-      var args = testHelpers.findAjaxRequest('name', 'ambari.service');
-      expect(args[0]).to.exists;
-      expect(args[0].sender).to.be.eql(mainController);
-      expect(args[0].data.fields).to.be.equal('?fields=RootServiceComponents/component_version,RootServiceComponents/properties/server.os_family&minimal_response=true');
-    });
-  });
-
   describe('#updateTitle', function() {
     beforeEach(function () {
       sinon.stub(App.router, 'get').withArgs('clusterController.clusterName').returns('c1')


[18/22] ambari git commit: AMBARI-20674 Able to hide the Delete menu item from UI for a given service (dili)

Posted by ao...@apache.org.
AMBARI-20674 Able to hide the Delete menu item from UI for a given service (dili)


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

Branch: refs/heads/branch-3.0-perf
Commit: 784ceeaaffeca873be49ee80e38c7de3cdaea2dd
Parents: 532ab59
Author: Di Li <di...@apache.org>
Authored: Thu Apr 6 16:58:57 2017 -0400
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Tue Apr 11 14:14:12 2017 +0300

----------------------------------------------------------------------
 .../server/controller/StackServiceResponse.java |  8 ++++
 .../internal/StackServiceResourceProvider.java  |  6 +++
 .../ambari/server/stack/ServiceModule.java      |  4 ++
 .../apache/ambari/server/state/ServiceInfo.java | 26 +++++++++++
 .../src/main/resources/properties.json          |  1 +
 .../ambari/server/state/ServiceInfoTest.java    | 47 ++++++++++++++++++++
 ambari-web/app/app.js                           |  4 ++
 ambari-web/app/mappers/stack_service_mapper.js  |  1 +
 ambari-web/app/models/host_component.js         |  3 +-
 ambari-web/app/models/stack_service.js          |  1 +
 .../test/mappers/stack_service_mapper_test.js   |  7 ++-
 ambari-web/test/views/main/service/item_test.js |  3 ++
 12 files changed, 109 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/784ceeaa/ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceResponse.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceResponse.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceResponse.java
index cbff300..8e4200d 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceResponse.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/StackServiceResponse.java
@@ -75,6 +75,8 @@ public class StackServiceResponse {
    */
   private boolean credentialStoreRequired;
 
+  private boolean isSupportDeleteViaUI;
+
   /**
    * Constructor.
    *
@@ -112,6 +114,8 @@ public class StackServiceResponse {
     credentialStoreSupported = service.isCredentialStoreSupported();
 
     credentialStoreEnabled = service.isCredentialStoreEnabled();
+
+    isSupportDeleteViaUI = service.isSupportDeleteViaUI();
   }
 
   public ServiceInfo.Selection getSelection() {
@@ -305,4 +309,8 @@ public class StackServiceResponse {
   public void setCredentialStoreRequired(boolean credentialStoreRequired) {
     this.credentialStoreRequired = credentialStoreRequired;
   }
+
+  public boolean isSupportDeleteViaUI(){
+    return isSupportDeleteViaUI;
+  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/784ceeaa/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackServiceResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackServiceResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackServiceResourceProvider.java
index a30d783..2964560 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackServiceResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StackServiceResourceProvider.java
@@ -98,6 +98,9 @@ public class StackServiceResourceProvider extends ReadOnlyResourceProvider {
   private static final String CREDENTIAL_STORE_ENABLED = PropertyHelper.getPropertyId(
       "StackServices", "credential_store_enabled");
 
+  private static final String SUPPORT_DELETE_VIA_UI = PropertyHelper.getPropertyId(
+      "StackServices", "support_delete_via_ui");
+
   private static Set<String> pkPropertyIds = new HashSet<>(
     Arrays.asList(new String[]{STACK_NAME_PROPERTY_ID,
       STACK_VERSION_PROPERTY_ID, SERVICE_NAME_PROPERTY_ID}));
@@ -206,6 +209,9 @@ public class StackServiceResourceProvider extends ReadOnlyResourceProvider {
     setResourceProperty(resource, CREDENTIAL_STORE_ENABLED,
         response.isCredentialStoreEnabled(), requestedIds);
 
+    setResourceProperty(resource, SUPPORT_DELETE_VIA_UI,
+        response.isSupportDeleteViaUI(), requestedIds);
+
     return resource;
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/784ceeaa/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceModule.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceModule.java b/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceModule.java
index fd65268..d65e758 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceModule.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/stack/ServiceModule.java
@@ -278,6 +278,10 @@ public class ServiceModule extends BaseModule<ServiceModule, ServiceInfo> implem
       serviceInfo.setSelection(parent.getSelection());
     }
 
+    if(null == serviceInfo.getSupportDeleteViaUIField()){
+      serviceInfo.setSupportDeleteViaUI(parent.isSupportDeleteViaUI());
+    }
+
     mergeCustomCommands(parent.getCustomCommands(), serviceInfo.getCustomCommands());
     mergeConfigDependencies(parent);
     mergeComponents(parentModule, allStacks, commonServices, extensions);

http://git-wip-us.apache.org/repos/asf/ambari/blob/784ceeaa/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java
index 0d0b78b..512ca18 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/ServiceInfo.java
@@ -82,6 +82,11 @@ public class ServiceInfo implements Validable{
   @XmlElement(name="deleted")
   private boolean isDeleted = false;
 
+  @XmlElement(name="supportDeleteViaUI")
+  private Boolean supportDeleteViaUIField;
+
+  private boolean supportDeleteViaUIInternal = true;
+
   @JsonIgnore
   @XmlTransient
   private volatile Map<String, Set<String>> configLayout = null;
@@ -291,6 +296,27 @@ public class ServiceInfo implements Validable{
     isDeleted = deleted;
   }
 
+  public Boolean getSupportDeleteViaUIField(){
+    return supportDeleteViaUIField;
+  }
+
+  public void setSupportDeleteViaUIField(Boolean supportDeleteViaUIField) {
+    this.supportDeleteViaUIField = supportDeleteViaUIField;
+  }
+
+  public boolean isSupportDeleteViaUI() {
+    if (null != supportDeleteViaUIField) {
+      return supportDeleteViaUIField.booleanValue();
+    }
+    // If set to null and has a parent, then the value would have already been resolved and set.
+    // Otherwise, return the default value (true).
+    return this.supportDeleteViaUIInternal;
+  }
+
+  public void setSupportDeleteViaUI(boolean supportDeleteViaUI){
+    this.supportDeleteViaUIInternal = supportDeleteViaUI;
+  }
+
   public String getName() {
     return name;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/784ceeaa/ambari-server/src/main/resources/properties.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/properties.json b/ambari-server/src/main/resources/properties.json
index 04d32ea..c2545fe 100644
--- a/ambari-server/src/main/resources/properties.json
+++ b/ambari-server/src/main/resources/properties.json
@@ -224,6 +224,7 @@
         "StackServices/credential_store_enabled",
         "StackServices/credential_store_required",
         "StackServices/properties",
+        "StackServices/support_delete_via_ui",
         "_"
     ],
     "StackConfiguration":[

http://git-wip-us.apache.org/repos/asf/ambari/blob/784ceeaa/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceInfoTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceInfoTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceInfoTest.java
index 1b9296e..c10c243 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceInfoTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/ServiceInfoTest.java
@@ -651,6 +651,53 @@ public class ServiceInfoTest {
     assertTrue("true".equals(serviceProperties.get(ServiceInfo.DEFAULT_SERVICE_MONITORED_PROPERTY.getKey())));
   }
 
+  @Test
+  public void testSupportDeleteViaUI() throws Exception {
+    //Explicitly set to true
+    String serviceInfoXml =
+      "<metainfo>" +
+      "  <schemaVersion>2.0</schemaVersion>" +
+      "  <services>" +
+      "    <service>" +
+      "      <name>HDFS</name>" +
+      "      <displayName>HDFS</displayName>" +
+      "      <supportDeleteViaUI>true</supportDeleteViaUI>" +
+      "    </service>" +
+      "  </services>" +
+      "</metainfo>";
+    Map<String, ServiceInfo> serviceInfoMap = getServiceInfo(serviceInfoXml);
+    assertTrue(serviceInfoMap.get("HDFS").isSupportDeleteViaUI());
+
+    //Explicitly set to false
+    serviceInfoXml =
+        "<metainfo>" +
+        "  <schemaVersion>2.0</schemaVersion>" +
+        "  <services>" +
+        "    <service>" +
+        "      <name>HDFS</name>" +
+        "      <displayName>HDFS</displayName>" +
+        "      <supportDeleteViaUI>false</supportDeleteViaUI>" +
+        "    </service>" +
+        "  </services>" +
+        "</metainfo>";
+      serviceInfoMap = getServiceInfo(serviceInfoXml);
+      assertFalse(serviceInfoMap.get("HDFS").isSupportDeleteViaUI());
+
+      //Default to true
+      serviceInfoXml =
+          "<metainfo>" +
+          "  <schemaVersion>2.0</schemaVersion>" +
+          "  <services>" +
+          "    <service>" +
+          "      <name>HDFS</name>" +
+          "      <displayName>HDFS</displayName>" +
+          "    </service>" +
+          "  </services>" +
+          "</metainfo>";
+        serviceInfoMap = getServiceInfo(serviceInfoXml);
+        assertTrue(serviceInfoMap.get("HDFS").isSupportDeleteViaUI());
+  }
+
   public static Map<String, ServiceInfo> getServiceInfo(String xml) throws JAXBException {
     InputStream configStream = new ByteArrayInputStream(xml.getBytes());
     JAXBContext jaxbContext = JAXBContext.newInstance(ServiceMetainfoXml.class);

http://git-wip-us.apache.org/repos/asf/ambari/blob/784ceeaa/ambari-web/app/app.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/app.js b/ambari-web/app/app.js
index 9c7d874..e32084c 100644
--- a/ambari-web/app/app.js
+++ b/ambari-web/app/app.js
@@ -304,6 +304,10 @@ module.exports = Em.Application.create({
 
     supportsServiceCheck: function() {
       return App.StackService.find().filterProperty('serviceCheckSupported').mapProperty('serviceName');
+    }.property('App.router.clusterController.isLoaded'),
+
+    supportsDeleteViaUI: function() {
+      return App.StackService.find().filterProperty('supportDeleteViaUi').mapProperty('serviceName');
     }.property('App.router.clusterController.isLoaded')
   }),
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/784ceeaa/ambari-web/app/mappers/stack_service_mapper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mappers/stack_service_mapper.js b/ambari-web/app/mappers/stack_service_mapper.js
index 4bda89d..8931066 100644
--- a/ambari-web/app/mappers/stack_service_mapper.js
+++ b/ambari-web/app/mappers/stack_service_mapper.js
@@ -40,6 +40,7 @@ App.stackServiceMapper = App.QuickDataMapper.create({
     is_service_with_widgets: 'is_service_with_widgets',
     required_services: 'required_services',
     service_check_supported: 'service_check_supported',
+    support_delete_via_ui: 'support_delete_via_ui',
     service_components_key: 'service_components',
     service_components_type: 'array',
     service_components: {

http://git-wip-us.apache.org/repos/asf/ambari/blob/784ceeaa/ambari-web/app/models/host_component.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/host_component.js b/ambari-web/app/models/host_component.js
index 3950f97..cdcf991 100644
--- a/ambari-web/app/models/host_component.js
+++ b/ambari-web/app/models/host_component.js
@@ -412,7 +412,8 @@ App.HostComponentActionMap = {
         action: 'deleteService',
         context: ctx.get('serviceName'),
         label: Em.I18n.t('services.service.actions.deleteService'),
-        cssClass: 'glyphicon glyphicon-remove'
+        cssClass: 'glyphicon glyphicon-remove',
+        isHidden: !App.get('services.supportsDeleteViaUI').contains(ctx.get('serviceName')) //hide the menu item when the service has a custom behavior setting in its metainfo.xml to disallow Delete Services via UI
       },
       IMMEDIATE_STOP_HAWQ_SERVICE: {
         action: 'executeHawqCustomCommand',

http://git-wip-us.apache.org/repos/asf/ambari/blob/784ceeaa/ambari-web/app/models/stack_service.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/stack_service.js b/ambari-web/app/models/stack_service.js
index 4f21288..241f6ab 100644
--- a/ambari-web/app/models/stack_service.js
+++ b/ambari-web/app/models/stack_service.js
@@ -34,6 +34,7 @@ App.StackService = DS.Model.extend({
   configTypes: DS.attr('object'),
   serviceVersion: DS.attr('string'),
   serviceCheckSupported: DS.attr('boolean'),
+  supportDeleteViaUi: DS.attr('boolean'),
   stackName: DS.attr('string'),
   stackVersion: DS.attr('string'),
   selection: DS.attr('string'),

http://git-wip-us.apache.org/repos/asf/ambari/blob/784ceeaa/ambari-web/test/mappers/stack_service_mapper_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mappers/stack_service_mapper_test.js b/ambari-web/test/mappers/stack_service_mapper_test.js
index 9da8b24..88b4b43 100644
--- a/ambari-web/test/mappers/stack_service_mapper_test.js
+++ b/ambari-web/test/mappers/stack_service_mapper_test.js
@@ -36,6 +36,7 @@ describe('App.stackServiceMapper', function () {
                 "ZOOKEEPER"
               ],
               "service_check_supported" : true,
+              "support_delete_via_ui" : false,
               "service_name" : "KAFKA",
               "service_version" : "0.8.1.2.2",
               "stack_name" : "HDP",
@@ -102,7 +103,8 @@ describe('App.stackServiceMapper', function () {
           },
           {
             "StackServices" : {
-              "service_name" : "ZOOKEEPER"
+              "service_name" : "ZOOKEEPER",
+              "support_delete_via_ui" : true
             },
             "components" : [ ],
             "artifacts" : [ ]
@@ -202,6 +204,7 @@ describe('App.stackServiceMapper', function () {
         isInstallable: true,
         isServiceWithWidgets: false,
         serviceCheckSupported: true,
+        supportDeleteViaUi : false,
         requiredServices: ["ZOOKEEPER"]
       },
       componentResult = {
@@ -253,6 +256,8 @@ describe('App.stackServiceMapper', function () {
       expect(components.findProperty('componentName', 'DATANODE').get('bulkCommandsMasterComponentName')).to.eql("NAMENODE");
       expect(components.findProperty('componentName', 'DATANODE').get('decommissionAllowed')).to.be.true;
       expect(components.findProperty('componentName', 'DATANODE').get('reassignAllowed')).to.be.true;
+
+      expect(services.findProperty('serviceName', 'ZOOKEEPER').get('supportDeleteViaUi')).to.be.true;
     });
 
   });

http://git-wip-us.apache.org/repos/asf/ambari/blob/784ceeaa/ambari-web/test/views/main/service/item_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/service/item_test.js b/ambari-web/test/views/main/service/item_test.js
index 4b2e6f9..e4a1940 100644
--- a/ambari-web/test/views/main/service/item_test.js
+++ b/ambari-web/test/views/main/service/item_test.js
@@ -144,6 +144,7 @@ describe('App.MainServiceItemView', function () {
         {
           serviceName: "HDFS",
           displayName: "HDFS",
+          supportDeleteViaUi: true,
           isSingleNode: true,
           serviceTypes: ["HA_MODE"],
           slaveComponents: [
@@ -449,6 +450,8 @@ describe('App.MainServiceItemView', function () {
             return ["NAMENODE", "SECONDARY_NAMENODE", "APP_TIMELINE_SERVER", "RESOURCEMANAGER", "WEBHCAT_SERVER", "OOZIE_SERVER"];
           case 'services.supportsServiceCheck':
             return ["HDFS", "MAPREDUCE2", "YARN", "HIVE", "HBASE", "PIG", "SQOOP", "OOZIE", "ZOOKEEPER", "FALCON", "STORM", "FLUME", "SLIDER", "KNOX", "KAFKA"];
+          case 'services.supportsDeleteViaUI':
+            return ["HDFS", "MAPREDUCE2", "YARN", "HIVE", "HBASE", "PIG", "SQOOP", "OOZIE", "ZOOKEEPER", "FALCON", "STORM", "FLUME", "SLIDER", "KNOX", "KAFKA"];
           case 'components.addableToHost':
             return ["DATANODE", "HDFS_CLIENT", "MAPREDUCE2_CLIENT", "NODEMANAGER", "YARN_CLIENT", "TEZ_CLIENT", "GANGLIA_MONITOR", "HCAT", "HIVE_CLIENT", "HIVE_METASTORE", "HIVE_SERVER", "WEBHCAT_SERVER", "HBASE_CLIENT", "HBASE_MASTER", "HBASE_REGIONSERVER", "PIG", "SQOOP", "OOZIE_CLIENT", "OOZIE_SERVER", "ZOOKEEPER_CLIENT", "ZOOKEEPER_SERVER", "FALCON_CLIENT", "SUPERVISOR", "FLUME_HANDLER", "METRICS_MONITOR", "KAFKA_BROKER", "KERBEROS_CLIENT", "KNOX_GATEWAY", "SLIDER", "SPARK_CLIENT"];
           case 'allHostNames.length':


[15/22] ambari git commit: AMBARI-20712 - Parallel Requests With Intersecting Hosts Don't Block Correctly (jonathanhurley)

Posted by ao...@apache.org.
AMBARI-20712 - Parallel Requests With Intersecting Hosts Don't Block Correctly (jonathanhurley)


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

Branch: refs/heads/branch-3.0-perf
Commit: 6b9a59753a924c6e07a68a0de61f0fb2792df102
Parents: 827cc03
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Sat Apr 8 15:17:14 2017 -0400
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Tue Apr 11 14:14:12 2017 +0300

----------------------------------------------------------------------
 .../server/actionmanager/ActionScheduler.java   | 154 ++++++++-----------
 .../server/actionmanager/HostRoleCommand.java   |  26 ++++
 .../AmbariCustomCommandExecutionHelper.java     |   3 +-
 .../server/orm/dao/HostRoleCommandDAO.java      |  49 ++++++
 .../orm/entities/HostRoleCommandEntity.java     |  33 +++-
 .../main/resources/Ambari-DDL-Derby-CREATE.sql  |   1 +
 .../main/resources/Ambari-DDL-MySQL-CREATE.sql  |   1 +
 .../main/resources/Ambari-DDL-Oracle-CREATE.sql |   1 +
 .../resources/Ambari-DDL-Postgres-CREATE.sql    |   1 +
 .../resources/Ambari-DDL-SQLAnywhere-CREATE.sql |   3 +-
 .../resources/Ambari-DDL-SQLServer-CREATE.sql   |   1 +
 .../actionmanager/TestActionScheduler.java      |  41 ++---
 12 files changed, 204 insertions(+), 110 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6b9a5975/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
index 758db35..316f2bd 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
@@ -42,7 +42,6 @@ import org.apache.ambari.server.ServiceComponentHostNotFoundException;
 import org.apache.ambari.server.ServiceComponentNotFoundException;
 import org.apache.ambari.server.agent.ActionQueue;
 import org.apache.ambari.server.agent.AgentCommand;
-import org.apache.ambari.server.agent.AgentCommand.AgentCommandType;
 import org.apache.ambari.server.agent.CancelCommand;
 import org.apache.ambari.server.agent.CommandReport;
 import org.apache.ambari.server.agent.ExecutionCommand;
@@ -355,15 +354,15 @@ class ActionScheduler implements Runnable {
       }
 
       Set<Long> runningRequestIds = new HashSet<>();
-      List<Stage> stages = db.getFirstStageInProgressPerRequest();
+      List<Stage> firstStageInProgressPerRequest = db.getFirstStageInProgressPerRequest();
       if (LOG.isDebugEnabled()) {
         LOG.debug("Scheduler wakes up");
-        LOG.debug("Processing {} in progress stages ", stages.size());
+        LOG.debug("Processing {} in progress stages", firstStageInProgressPerRequest.size());
       }
 
-      publishInProgressTasks(stages);
+      publishInProgressTasks(firstStageInProgressPerRequest);
 
-      if (stages.isEmpty()) {
+      if (firstStageInProgressPerRequest.isEmpty()) {
         // Nothing to do
         if (LOG.isDebugEnabled()) {
           LOG.debug("There are no stages currently in progress.");
@@ -375,11 +374,19 @@ class ActionScheduler implements Runnable {
 
       int i_stage = 0;
 
-      HashSet<String> hostsWithTasks = getListOfHostsWithPendingTask(stages);
-      actionQueue.updateListOfHostsWithPendingTask(hostsWithTasks);
+      // get the range of requests in progress
+      long iLowestRequestIdInProgress = firstStageInProgressPerRequest.get(0).getRequestId();
+      long iHighestRequestIdInProgress = firstStageInProgressPerRequest.get(
+          firstStageInProgressPerRequest.size() - 1).getRequestId();
 
-      stages = filterParallelPerHostStages(stages);
-      // At this point the stages is a filtered list
+      List<String> hostsWithPendingTasks = hostRoleCommandDAO.getHostsWithPendingTasks(
+          iLowestRequestIdInProgress, iHighestRequestIdInProgress);
+
+      actionQueue.updateListOfHostsWithPendingTask(new HashSet<>(hostsWithPendingTasks));
+
+      // filter the stages in progress down to those which can be scheduled in
+      // parallel
+      List<Stage> stages = filterParallelPerHostStages(firstStageInProgressPerRequest);
 
       boolean exclusiveRequestIsGoing = false;
       // This loop greatly depends on the fact that order of stages in
@@ -565,123 +572,92 @@ class ActionScheduler implements Runnable {
   }
 
   /**
-   * Returns the list of hosts that have a task assigned
-   *
-   * @param stages
-   * @return
-   */
-  private HashSet<String> getListOfHostsWithPendingTask(List<Stage> stages) {
-    HashSet<String> hostsWithTasks = new HashSet<>();
-    for (Stage s : stages) {
-      hostsWithTasks.addAll(s.getHosts());
-    }
-    return hostsWithTasks;
-  }
-
-  /**
-   * Returns filtered list of stages such that the returned list is an ordered list of stages that may
-   * be executed in parallel or in the order in which they are presented
+   * Returns filtered list of stages such that the returned list is an ordered
+   * list of stages that may be executed in parallel or in the order in which
+   * they are presented.
    * <p/>
-   * Assumption: the list of stages supplied as input are ordered by request id and then stage id.
+   * The specified stages must be ordered by request ID and may only contain the
+   * next stage in progress per request (as returned by
+   * {@link ActionDBAccessor#getFirstStageInProgressPerRequest()}. This is
+   * because there is a requirement that within a request, no two stages may
+   * ever run in parallel.
    * <p/>
-   * Rules:
+   * The following rules will be applied to the list:
    * <ul>
-   * <li>
-   * Stages are filtered such that the first stage in the list (assumed to be the first pending
-   * stage from the earliest active request) has priority
-   * </li>
-   * <li>
-   * No stage in any request may be executed before an earlier stage in the same request
-   * </li>
-   * <li>
-   * A stages in different requests may be performed in parallel if the relevant hosts for the
-   * stage in the later requests do not intersect with the union of hosts from (pending) stages
-   * in earlier requests
+   * <li>Stages are filtered such that the first stage in the list (assumed to
+   * be the first pending stage from the earliest active request) has priority.
    * </li>
+   * <li>No stage in any request may be executed before an earlier stage in the
+   * same request. This requirement is automatically covered by virtue of the
+   * supplied stages only being for the next stage in progress per request.</li>
+   * <li>A stage in different request may be performed in parallel
+   * if-and-only-if the relevant hosts for the stage in the later requests do
+   * not intersect with the union of hosts from (pending) stages in earlier
+   * requests. In order to accomplish this</li>
    * </ul>
    *
-   * @param stages the stages to process
+   * @param firstStageInProgressPerRequest
+   *          the stages to process, one stage per request
    * @return a list of stages that may be executed in parallel
    */
-  private List<Stage> filterParallelPerHostStages(List<Stage> stages) {
+  private List<Stage> filterParallelPerHostStages(List<Stage> firstStageInProgressPerRequest) {
+    // if there's only 1 stage in progress in 1 request, simply return that stage
+    if (firstStageInProgressPerRequest.size() == 1) {
+      return firstStageInProgressPerRequest;
+    }
+
     List<Stage> retVal = new ArrayList<>();
-    Set<String> affectedHosts = new HashSet<>();
-    Set<Long> affectedRequests = new HashSet<>();
 
-    for (Stage s : stages) {
-      long requestId = s.getRequestId();
+    // set the lower range (inclusive) of requests to limit the query a bit
+    // since there can be a LOT of commands
+    long lowerRequestIdInclusive = firstStageInProgressPerRequest.get(0).getRequestId();
+
+    // determine if this stage can be scheduled in parallel with the other
+    // stages from other requests
+    for (Stage stage : firstStageInProgressPerRequest) {
+      long requestId = stage.getRequestId();
 
       if (LOG.isTraceEnabled()) {
-        LOG.trace("==> Processing stage: {}/{} ({}) for {}", requestId, s.getStageId(), s.getRequestContext());
+        LOG.trace("==> Processing stage: {}/{} ({}) for {}", requestId, stage.getStageId(), stage.getRequestContext());
       }
 
       boolean addStage = true;
 
+      // there are at least 2 request in progress concurrently; determine which
+      // hosts are affected
+      HashSet<String> hostsInProgressForEarlierRequests = new HashSet<>(
+          hostRoleCommandDAO.getBlockingHostsForRequest(lowerRequestIdInclusive, requestId));
+
       // Iterate over the relevant hosts for this stage to see if any intersect with the set of
       // hosts needed for previous stages.  If any intersection occurs, this stage may not be
       // executed in parallel.
-      for (String host : s.getHosts()) {
+      for (String host : stage.getHosts()) {
         LOG.trace("===> Processing Host {}", host);
 
-        if (affectedHosts.contains(host)) {
+        if (hostsInProgressForEarlierRequests.contains(host)) {
           if (LOG.isTraceEnabled()) {
-            LOG.trace("===>  Skipping stage since it utilizes at least one host that a previous stage requires: {}/{} ({})", s.getRequestId(), s.getStageId(), s.getRequestContext());
+            LOG.trace("===>  Skipping stage since it utilizes at least one host that a previous stage requires: {}/{} ({})", stage.getRequestId(), stage.getStageId(), stage.getRequestContext());
           }
 
-          addStage &= false;
-        } else {
-          if (!Stage.INTERNAL_HOSTNAME.equalsIgnoreCase(host) && !isStageHasBackgroundCommandsOnly(s, host)) {
-            LOG.trace("====>  Adding host to affected hosts: {}", host);
-            affectedHosts.add(host);
-          }
-
-          addStage &= true;
-        }
-      }
-
-      // If this stage is for a request that we have already processed, the it cannot execute in
-      // parallel since only one stage per request my execute at a time. The first time we encounter
-      // a request id, will be for the first pending stage for that request, so it is a candidate
-      // for execution at this time - if the previous test for host intersection succeeds.
-      if (affectedRequests.contains(requestId)) {
-        if (LOG.isTraceEnabled()) {
-          LOG.trace("===>  Skipping stage since the request it is in has been processed already: {}/{} ({})", s.getRequestId(), s.getStageId(), s.getRequestContext());
-        }
-
-        addStage = false;
-      } else {
-        if (LOG.isTraceEnabled()) {
-          LOG.trace("====>  Adding request to affected requests: {}", requestId);
+          addStage = false;
+          break;
         }
-
-        affectedRequests.add(requestId);
-        addStage &= true;
       }
 
-      // If both tests pass - the stage is the first pending stage in its request and the hosts
-      // required in the stage do not intersect with hosts from stages that should occur before this,
-      // than add it to the list of stages that may be executed in parallel.
+      // add the stage is no other prior stages for prior requests intersect the
+      // hosts in this stage
       if (addStage) {
         if (LOG.isTraceEnabled()) {
-          LOG.trace("===>  Adding stage to return value: {}/{} ({})", s.getRequestId(), s.getStageId(), s.getRequestContext());
+          LOG.trace("===>  Adding stage to return value: {}/{} ({})", stage.getRequestId(), stage.getStageId(), stage.getRequestContext());
         }
 
-        retVal.add(s);
+        retVal.add(stage);
       }
     }
 
     return retVal;
   }
 
-  private boolean isStageHasBackgroundCommandsOnly(Stage s, String host) {
-    for (ExecutionCommandWrapper c : s.getExecutionCommands(host)) {
-      if (c.getCommandType() != AgentCommandType.BACKGROUND_EXECUTION_COMMAND) {
-        return false;
-      }
-    }
-    return true;
-  }
-
   private boolean hasPreviousStageFailed(Stage stage) {
     boolean failed = false;
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/6b9a5975/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostRoleCommand.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostRoleCommand.java b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostRoleCommand.java
index 651eb24..87a6edf 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostRoleCommand.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/HostRoleCommand.java
@@ -68,6 +68,7 @@ public class HostRoleCommand {
   private String commandDetail;
   private String customCommandName;
   private ExecutionCommandWrapper executionCommandWrapper;
+  private boolean isBackgroundCommand = false;
 
   @Inject
   private ExecutionCommandDAO executionCommandDAO;
@@ -179,6 +180,7 @@ public class HostRoleCommand {
     event = new ServiceComponentHostEventWrapper(hostRoleCommandEntity.getEvent());
     commandDetail = hostRoleCommandEntity.getCommandDetail();
     customCommandName = hostRoleCommandEntity.getCustomCommandName();
+    isBackgroundCommand = hostRoleCommandEntity.isBackgroundCommand();
   }
 
   //todo: why is this not symmetrical with the constructor which takes an entity
@@ -201,6 +203,7 @@ public class HostRoleCommand {
     hostRoleCommandEntity.setRoleCommand(roleCommand);
     hostRoleCommandEntity.setCommandDetail(commandDetail);
     hostRoleCommandEntity.setCustomCommandName(customCommandName);
+    hostRoleCommandEntity.setBackgroundCommand(isBackgroundCommand);
 
     HostEntity hostEntity = hostDAO.findById(hostId);
     if (null != hostEntity) {
@@ -433,6 +436,29 @@ public class HostRoleCommand {
   }
 
   /**
+   * Gets whether this command runs in the background and does not block other
+   * commands.
+   *
+   * @return {@code true} if this command runs in the background, {@code false}
+   *         otherise.
+   */
+  public boolean isBackgroundCommand() {
+    return isBackgroundCommand;
+  }
+
+  /**
+   * Sets whether this command runs in the background and does not block other
+   * commands.
+   *
+   * @param isBackgroundCommand
+   *          {@code true} if this command runs in the background, {@code false}
+   *          otherise.
+   */
+  public void setBackgroundCommand(boolean isBackgroundCommand) {
+    this.isBackgroundCommand = isBackgroundCommand;
+  }
+
+  /**
    * Gets whether commands which fail and are retryable are automatically
    * skipped and marked with {@link HostRoleStatus#SKIPPED_FAILED}.
    *

http://git-wip-us.apache.org/repos/asf/ambari/blob/6b9a5975/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
index 77d5bf8..d5018f5 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariCustomCommandExecutionHelper.java
@@ -144,7 +144,7 @@ public class AmbariCustomCommandExecutionHelper {
   private final static String ALIGN_MAINTENANCE_STATE = "align_maintenance_state";
 
   public final static int MIN_STRICT_SERVICE_CHECK_TIMEOUT = 120;
-  
+
   @Inject
   private ActionMetadata actionMetadata;
 
@@ -378,6 +378,7 @@ public class AmbariCustomCommandExecutionHelper {
 
       //set type background
       if(customCommandDefinition != null && customCommandDefinition.isBackground()){
+        cmd.setBackgroundCommand(true);
         execCmd.setCommandType(AgentCommandType.BACKGROUND_EXECUTION_COMMAND);
       }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/6b9a5975/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandDAO.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandDAO.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandDAO.java
index 79b8bc9..7318162 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandDAO.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/dao/HostRoleCommandDAO.java
@@ -43,6 +43,7 @@ import org.apache.ambari.server.RoleCommand;
 import org.apache.ambari.server.actionmanager.HostRoleCommand;
 import org.apache.ambari.server.actionmanager.HostRoleCommandFactory;
 import org.apache.ambari.server.actionmanager.HostRoleStatus;
+import org.apache.ambari.server.agent.AgentCommand.AgentCommandType;
 import org.apache.ambari.server.api.query.JpaPredicateVisitor;
 import org.apache.ambari.server.api.query.JpaSortBuilder;
 import org.apache.ambari.server.configuration.Configuration;
@@ -914,6 +915,54 @@ public class HostRoleCommandDAO {
   }
 
   /**
+   * Gets a lists of hosts with commands in progress given a range of requests.
+   * The range of requests should include all requests with at least 1 stage in
+   * progress.
+   *
+   * @return the list of hosts with commands in progress.
+   * @see HostRoleStatus#IN_PROGRESS_STATUSES
+   */
+  @RequiresSession
+  public List<String> getHostsWithPendingTasks(long iLowestRequestIdInProgress,
+      long iHighestRequestIdInProgress) {
+    TypedQuery<String> query = entityManagerProvider.get().createNamedQuery(
+        "HostRoleCommandEntity.findHostsByCommandStatus", String.class);
+
+    query.setParameter("iLowestRequestIdInProgress", iLowestRequestIdInProgress);
+    query.setParameter("iHighestRequestIdInProgress", iHighestRequestIdInProgress);
+    query.setParameter("statuses", HostRoleStatus.IN_PROGRESS_STATUSES);
+    return daoUtils.selectList(query);
+  }
+
+  /**
+   * Gets a lists of hosts with commands in progress which occurr before the
+   * specified request ID. This will only return commands which are not
+   * {@link AgentCommandType#BACKGROUND_EXECUTION_COMMAND} as thsee commands do
+   * not block future requests.
+   *
+   * @param lowerRequestIdInclusive
+   *          the lowest request ID to consider (inclusive) when getting any
+   *          blocking hosts.
+   * @param requestId
+   *          the request ID to calculate any blocking hosts for (essentially,
+   *          the upper limit exclusive)
+   * @return the list of hosts from older running requests which will block
+   *         those same hosts in the specified request ID.
+   * @see HostRoleStatus#IN_PROGRESS_STATUSES
+   */
+  @RequiresSession
+  public List<String> getBlockingHostsForRequest(long lowerRequestIdInclusive,
+      long requestId) {
+    TypedQuery<String> query = entityManagerProvider.get().createNamedQuery(
+        "HostRoleCommandEntity.getBlockingHostsForRequest", String.class);
+
+    query.setParameter("lowerRequestIdInclusive", lowerRequestIdInclusive);
+    query.setParameter("upperRequestIdExclusive", requestId);
+    query.setParameter("statuses", HostRoleStatus.IN_PROGRESS_STATUSES);
+    return daoUtils.selectList(query);
+  }
+
+  /**
    * The {@link HostRoleCommandPredicateVisitor} is used to convert an Ambari
    * {@link Predicate} into a JPA {@link javax.persistence.criteria.Predicate}.
    */

http://git-wip-us.apache.org/repos/asf/ambari/blob/6b9a5975/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostRoleCommandEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostRoleCommandEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostRoleCommandEntity.java
index a809295..fdec5f0 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostRoleCommandEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/HostRoleCommandEntity.java
@@ -70,7 +70,14 @@ import org.apache.commons.lang.ArrayUtils;
     @NamedQuery(name = "HostRoleCommandEntity.findByHostRoleNullHost", query = "SELECT command FROM HostRoleCommandEntity command WHERE command.hostEntity IS NULL AND command.requestId=:requestId AND command.stageId=:stageId AND command.role=:role"),
     @NamedQuery(name = "HostRoleCommandEntity.findByStatusBetweenStages", query = "SELECT command FROM HostRoleCommandEntity command WHERE command.requestId = :requestId AND command.stageId >= :minStageId AND command.stageId <= :maxStageId AND command.status = :status"),
     @NamedQuery(name = "HostRoleCommandEntity.updateAutoSkipExcludeRoleCommand", query = "UPDATE HostRoleCommandEntity command SET command.autoSkipOnFailure = :autoSkipOnFailure WHERE command.requestId = :requestId AND command.roleCommand <> :roleCommand"),
-    @NamedQuery(name = "HostRoleCommandEntity.updateAutoSkipForRoleCommand", query = "UPDATE HostRoleCommandEntity command SET command.autoSkipOnFailure = :autoSkipOnFailure WHERE command.requestId = :requestId AND command.roleCommand = :roleCommand")
+    @NamedQuery(name = "HostRoleCommandEntity.updateAutoSkipForRoleCommand", query = "UPDATE HostRoleCommandEntity command SET command.autoSkipOnFailure = :autoSkipOnFailure WHERE command.requestId = :requestId AND command.roleCommand = :roleCommand"),
+    @NamedQuery(
+        name = "HostRoleCommandEntity.findHostsByCommandStatus",
+        query = "SELECT DISTINCT(host.hostName) FROM HostRoleCommandEntity command, HostEntity host WHERE (command.requestId >= :iLowestRequestIdInProgress AND command.requestId <= :iHighestRequestIdInProgress) AND command.status IN :statuses AND command.hostId = host.hostId AND host.hostName IS NOT NULL"),
+    @NamedQuery(
+        name = "HostRoleCommandEntity.getBlockingHostsForRequest",
+        query = "SELECT DISTINCT(host.hostName) FROM HostRoleCommandEntity command, HostEntity host WHERE command.requestId >= :lowerRequestIdInclusive AND command.requestId < :upperRequestIdExclusive AND command.status IN :statuses AND command.isBackgroundCommand=0 AND command.hostId = host.hostId AND host.hostName IS NOT NULL")
+
 })
 public class HostRoleCommandEntity {
 
@@ -195,6 +202,10 @@ public class HostRoleCommandEntity {
   @OneToOne(mappedBy = "hostRoleCommandEntity", cascade = CascadeType.REMOVE)
   private TopologyLogicalTaskEntity topologyLogicalTaskEntity;
 
+  @Basic
+  @Column(name = "is_background_command", nullable = false)
+  private short isBackgroundCommand = 0;
+
   public Long getTaskId() {
     return taskId;
   }
@@ -407,6 +418,26 @@ public class HostRoleCommandEntity {
     autoSkipOnFailure = skipFailures ? 1 : 0;
   }
 
+  /**
+   * Sets whether this is a command is a background command and will not block
+   * other commands.
+   *
+   * @param runInBackground
+   *          {@code true} if this is a background command, {@code false}
+   *          otherwise.
+   */
+  public void setBackgroundCommand(boolean runInBackground) {
+    isBackgroundCommand = (short) (runInBackground ? 1 : 0);
+  }
+
+  /**
+   * Gets whether this command runs in the background and will not block other
+   * commands.
+   */
+  public boolean isBackgroundCommand() {
+    return isBackgroundCommand == 0 ? false : true;
+  }
+
   @Override
   public boolean equals(Object o) {
     if (this == o) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/6b9a5975/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
index 6744a74..5785a9d 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Derby-CREATE.sql
@@ -383,6 +383,7 @@ CREATE TABLE host_role_command (
   role_command VARCHAR(255),
   command_detail VARCHAR(255),
   custom_command_name VARCHAR(255),
+  is_background_command SMALLINT DEFAULT 0 NOT NULL,
   CONSTRAINT PK_host_role_command PRIMARY KEY (task_id),
   CONSTRAINT FK_host_role_command_host_id FOREIGN KEY (host_id) REFERENCES hosts (host_id),
   CONSTRAINT FK_host_role_command_stage_id FOREIGN KEY (stage_id, request_id) REFERENCES stage (stage_id, request_id));

http://git-wip-us.apache.org/repos/asf/ambari/blob/6b9a5975/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
index 6279f83..96ef0ac 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-MySQL-CREATE.sql
@@ -404,6 +404,7 @@ CREATE TABLE host_role_command (
   structured_out LONGBLOB,
   command_detail VARCHAR(255),
   custom_command_name VARCHAR(255),
+  is_background_command SMALLINT DEFAULT 0 NOT NULL,
   CONSTRAINT PK_host_role_command PRIMARY KEY (task_id),
   CONSTRAINT FK_host_role_command_host_id FOREIGN KEY (host_id) REFERENCES hosts (host_id),
   CONSTRAINT FK_host_role_command_stage_id FOREIGN KEY (stage_id, request_id) REFERENCES stage (stage_id, request_id));

http://git-wip-us.apache.org/repos/asf/ambari/blob/6b9a5975/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
index 470eb60..3396ce9 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Oracle-CREATE.sql
@@ -384,6 +384,7 @@ CREATE TABLE host_role_command (
   structured_out BLOB NULL,
   command_detail VARCHAR2(255) NULL,
   custom_command_name VARCHAR2(255) NULL,
+  is_background_command SMALLINT DEFAULT 0 NOT NULL,
   CONSTRAINT PK_host_role_command PRIMARY KEY (task_id),
   CONSTRAINT FK_host_role_command_host_id FOREIGN KEY (host_id) REFERENCES hosts (host_id),
   CONSTRAINT FK_host_role_command_stage_id FOREIGN KEY (stage_id, request_id) REFERENCES stage (stage_id, request_id));

http://git-wip-us.apache.org/repos/asf/ambari/blob/6b9a5975/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
index 87ffb7f..c6bfa94 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-Postgres-CREATE.sql
@@ -383,6 +383,7 @@ CREATE TABLE host_role_command (
   role_command VARCHAR(255),
   command_detail VARCHAR(255),
   custom_command_name VARCHAR(255),
+  is_background_command SMALLINT DEFAULT 0 NOT NULL,
   CONSTRAINT PK_host_role_command PRIMARY KEY (task_id),
   CONSTRAINT FK_host_role_command_host_id FOREIGN KEY (host_id) REFERENCES hosts (host_id),
   CONSTRAINT FK_host_role_command_stage_id FOREIGN KEY (stage_id, request_id) REFERENCES stage (stage_id, request_id));

http://git-wip-us.apache.org/repos/asf/ambari/blob/6b9a5975/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
index a460194..bbf5d3c 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-SQLAnywhere-CREATE.sql
@@ -75,7 +75,7 @@ CREATE TABLE clusterconfig (
   config_data TEXT NOT NULL,
   config_attributes TEXT,
   create_timestamp NUMERIC(19) NOT NULL,
-  selected_timestamp NUMERIC(19) NOT NULL DEFAULT 0,  
+  selected_timestamp NUMERIC(19) NOT NULL DEFAULT 0,
   CONSTRAINT PK_clusterconfig PRIMARY KEY (config_id),
   CONSTRAINT FK_clusterconfig_cluster_id FOREIGN KEY (cluster_id) REFERENCES clusters (cluster_id),
   CONSTRAINT FK_clusterconfig_stack_id FOREIGN KEY (stack_id) REFERENCES stack(stack_id),
@@ -382,6 +382,7 @@ CREATE TABLE host_role_command (
   structured_out IMAGE,
   command_detail VARCHAR(255),
   custom_command_name VARCHAR(255),
+  is_background_command SMALLINT DEFAULT 0 NOT NULL,
   CONSTRAINT PK_host_role_command PRIMARY KEY (task_id),
   CONSTRAINT FK_host_role_command_host_id FOREIGN KEY (host_id) REFERENCES hosts (host_id),
   CONSTRAINT FK_host_role_command_stage_id FOREIGN KEY (stage_id, request_id) REFERENCES stage (stage_id, request_id));

http://git-wip-us.apache.org/repos/asf/ambari/blob/6b9a5975/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql b/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
index 237c892..13ab01d 100644
--- a/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
+++ b/ambari-server/src/main/resources/Ambari-DDL-SQLServer-CREATE.sql
@@ -388,6 +388,7 @@ CREATE TABLE host_role_command (
   role_command VARCHAR(255),
   command_detail VARCHAR(255),
   custom_command_name VARCHAR(255),
+  is_background_command SMALLINT DEFAULT 0 NOT NULL,
   CONSTRAINT PK_host_role_command PRIMARY KEY CLUSTERED (task_id),
   CONSTRAINT FK_host_role_command_host_id FOREIGN KEY (host_id) REFERENCES hosts (host_id),
   CONSTRAINT FK_host_role_command_stage_id FOREIGN KEY (stage_id, request_id) REFERENCES stage (stage_id, request_id));

http://git-wip-us.apache.org/repos/asf/ambari/blob/6b9a5975/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java
index d7d3d40..b1a7524 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/actionmanager/TestActionScheduler.java
@@ -1106,41 +1106,45 @@ public class TestActionScheduler {
     hosts.put(hostname4, sch);
     when(scomp.getServiceComponentHosts()).thenReturn(hosts);
 
-    List<Stage> stages = new ArrayList<>();
-    stages.add(
+    List<Stage> firstStageInProgressPerRequest = new ArrayList<>();
+
+    firstStageInProgressPerRequest.add(
             getStageWithSingleTask(
                     hostname1, "cluster1", Role.DATANODE,
                     RoleCommand.START, Service.Type.HDFS, 1, 1, 1));
-    stages.add( // Stage with the same hostname, should not be scheduled
+
+    // Stage with the same hostname, should not be scheduled
+    firstStageInProgressPerRequest.add(
             getStageWithSingleTask(
                     hostname1, "cluster1", Role.GANGLIA_MONITOR,
                     RoleCommand.START, Service.Type.GANGLIA, 2, 2, 2));
 
-    stages.add(
+    firstStageInProgressPerRequest.add(
             getStageWithSingleTask(
                     hostname2, "cluster1", Role.DATANODE,
                     RoleCommand.START, Service.Type.HDFS, 3, 3, 3));
 
-    stages.add(
+    firstStageInProgressPerRequest.add(
         getStageWithSingleTask(
             hostname3, "cluster1", Role.DATANODE,
             RoleCommand.START, Service.Type.HDFS, 4, 4, 4));
 
-    stages.add( // Stage with the same request id, should not be scheduled
-        getStageWithSingleTask(
-            hostname4, "cluster1", Role.GANGLIA_MONITOR,
-            RoleCommand.START, Service.Type.GANGLIA, 5, 5, 4));
-
     ActionDBAccessor db = mock(ActionDBAccessor.class);
     HostRoleCommandDAO hostRoleCommandDAOMock = mock(HostRoleCommandDAO.class);
     Mockito.doNothing().when(hostRoleCommandDAOMock).publishTaskCreateEvent(anyListOf(HostRoleCommand.class));
 
+    List<String> blockingHostsRequest1 = new ArrayList<>();
+    when(hostRoleCommandDAOMock.getBlockingHostsForRequest(1, 1)).thenReturn(blockingHostsRequest1);
+
+    List<String> blockingHostsRequest2 = Lists.newArrayList(hostname1);
+    when(hostRoleCommandDAOMock.getBlockingHostsForRequest(1, 2)).thenReturn(blockingHostsRequest2);
+
     RequestEntity request = mock(RequestEntity.class);
     when(request.isExclusive()).thenReturn(false);
     when(db.getRequestEntity(anyLong())).thenReturn(request);
 
-    when(db.getCommandsInProgressCount()).thenReturn(stages.size());
-    when(db.getFirstStageInProgressPerRequest()).thenReturn(stages);
+    when(db.getCommandsInProgressCount()).thenReturn(firstStageInProgressPerRequest.size());
+    when(db.getFirstStageInProgressPerRequest()).thenReturn(firstStageInProgressPerRequest);
 
     Properties properties = new Properties();
     Configuration conf = new Configuration(properties);
@@ -1152,11 +1156,10 @@ public class TestActionScheduler {
 
     scheduler.doWork();
 
-    Assert.assertEquals(HostRoleStatus.QUEUED, stages.get(0).getHostRoleStatus(hostname1, "DATANODE"));
-    Assert.assertEquals(HostRoleStatus.PENDING, stages.get(1).getHostRoleStatus(hostname1, "GANGLIA_MONITOR"));
-    Assert.assertEquals(HostRoleStatus.QUEUED, stages.get(2).getHostRoleStatus(hostname2, "DATANODE"));
-    Assert.assertEquals(HostRoleStatus.QUEUED, stages.get(3).getHostRoleStatus(hostname3, "DATANODE"));
-    Assert.assertEquals(HostRoleStatus.PENDING, stages.get(4).getHostRoleStatus(hostname4, "GANGLIA_MONITOR"));
+    Assert.assertEquals(HostRoleStatus.QUEUED, firstStageInProgressPerRequest.get(0).getHostRoleStatus(hostname1, "DATANODE"));
+    Assert.assertEquals(HostRoleStatus.PENDING, firstStageInProgressPerRequest.get(1).getHostRoleStatus(hostname1, "GANGLIA_MONITOR"));
+    Assert.assertEquals(HostRoleStatus.QUEUED, firstStageInProgressPerRequest.get(2).getHostRoleStatus(hostname2, "DATANODE"));
+    Assert.assertEquals(HostRoleStatus.QUEUED, firstStageInProgressPerRequest.get(3).getHostRoleStatus(hostname3, "DATANODE"));
   }
 
 
@@ -2065,6 +2068,8 @@ public class TestActionScheduler {
     hosts.put(hostname1, sch1);
     when(scomp.getServiceComponentHosts()).thenReturn(hosts);
 
+    HostRoleCommandDAO hostRoleCommandDAO = mock(HostRoleCommandDAO.class);
+
     HostEntity hostEntity = new HostEntity();
     hostEntity.setHostName(hostname1);
     hostDAO.create(hostEntity);
@@ -2100,7 +2105,7 @@ public class TestActionScheduler {
 
     ActionScheduler scheduler = new ActionScheduler(100, 50000, db, aq, fsm, 3,
         new HostsMap((String) null), unitOfWork, null, conf, entityManagerProviderMock,
-        (HostRoleCommandDAO)null, (HostRoleCommandFactory)null);
+        hostRoleCommandDAO, (HostRoleCommandFactory) null);
 
     final CountDownLatch abortCalls = new CountDownLatch(2);
 


[17/22] ambari git commit: AMBARI-20716. Support amazonlinux 2017 in Ambari (aonishuk)

Posted by ao...@apache.org.
AMBARI-20716. Support amazonlinux 2017 in Ambari (aonishuk)


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

Branch: refs/heads/branch-3.0-perf
Commit: 40ab38e9984e3ff8f55748c4560b7105ec9c181b
Parents: 7871578
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Mon Apr 10 12:43:28 2017 +0300
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Tue Apr 11 14:14:12 2017 +0300

----------------------------------------------------------------------
 .../src/main/python/ambari_commons/resources/os_family.json         | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/40ab38e9/ambari-common/src/main/python/ambari_commons/resources/os_family.json
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/ambari_commons/resources/os_family.json b/ambari-common/src/main/python/ambari_commons/resources/os_family.json
index e9bd1a4..859ce56 100644
--- a/ambari-common/src/main/python/ambari_commons/resources/os_family.json
+++ b/ambari-common/src/main/python/ambari_commons/resources/os_family.json
@@ -68,6 +68,7 @@
     "aliases": {
       "amazon2015": "amazon6",
       "amazon2016": "amazon6",
+      "amazon2017": "amazon6",
       "suse11sp3": "suse11"
     }
 }


[07/22] ambari git commit: AMBARI-20691. Fix the default service version numbers in HDP-2.6 service metainfo files (dgrinenko via dlysnichenko)

Posted by ao...@apache.org.
AMBARI-20691. Fix the default service version numbers in HDP-2.6 service metainfo files (dgrinenko via dlysnichenko)


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

Branch: refs/heads/branch-3.0-perf
Commit: 9fecba83295c26fa4c4327a7175dfe85815731d1
Parents: ecc3fdf
Author: Lisnichenko Dmitro <dl...@hortonworks.com>
Authored: Thu Apr 6 17:57:56 2017 +0300
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Tue Apr 11 14:14:12 2017 +0300

----------------------------------------------------------------------
 .../main/resources/stacks/HDP/2.6/services/ACCUMULO/metainfo.xml   | 2 +-
 .../src/main/resources/stacks/HDP/2.6/services/ATLAS/metainfo.xml  | 2 +-
 .../src/main/resources/stacks/HDP/2.6/services/DRUID/metainfo.xml  | 2 +-
 .../src/main/resources/stacks/HDP/2.6/services/FALCON/metainfo.xml | 2 +-
 .../src/main/resources/stacks/HDP/2.6/services/FLUME/metainfo.xml  | 2 +-
 .../src/main/resources/stacks/HDP/2.6/services/HBASE/metainfo.xml  | 2 +-
 .../src/main/resources/stacks/HDP/2.6/services/HDFS/metainfo.xml   | 2 +-
 .../src/main/resources/stacks/HDP/2.6/services/HIVE/metainfo.xml   | 2 +-
 .../src/main/resources/stacks/HDP/2.6/services/KAFKA/metainfo.xml  | 2 +-
 .../src/main/resources/stacks/HDP/2.6/services/KNOX/metainfo.xml   | 2 +-
 .../src/main/resources/stacks/HDP/2.6/services/MAHOUT/metainfo.xml | 2 +-
 .../src/main/resources/stacks/HDP/2.6/services/OOZIE/metainfo.xml  | 2 +-
 .../src/main/resources/stacks/HDP/2.6/services/PIG/metainfo.xml    | 2 +-
 .../src/main/resources/stacks/HDP/2.6/services/RANGER/metainfo.xml | 2 +-
 .../main/resources/stacks/HDP/2.6/services/RANGER_KMS/metainfo.xml | 2 +-
 .../src/main/resources/stacks/HDP/2.6/services/SLIDER/metainfo.xml | 2 +-
 .../src/main/resources/stacks/HDP/2.6/services/STORM/metainfo.xml  | 2 +-
 .../src/main/resources/stacks/HDP/2.6/services/YARN/metainfo.xml   | 2 +-
 18 files changed, 18 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/9fecba83/ambari-server/src/main/resources/stacks/HDP/2.6/services/ACCUMULO/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/ACCUMULO/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/ACCUMULO/metainfo.xml
index 3f619af..15888ba 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/ACCUMULO/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/ACCUMULO/metainfo.xml
@@ -20,7 +20,7 @@
   <services>
     <service>
       <name>ACCUMULO</name>
-      <version>1.7.0.2.6</version>
+      <version>1.7.0</version>
     </service>
   </services>
 </metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/9fecba83/ambari-server/src/main/resources/stacks/HDP/2.6/services/ATLAS/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/ATLAS/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/ATLAS/metainfo.xml
index a652a7b..6e1a52e 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/ATLAS/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/ATLAS/metainfo.xml
@@ -20,7 +20,7 @@
   <services>
     <service>
       <name>ATLAS</name>
-      <version>0.8.0.2.6</version>
+      <version>0.8.0</version>
 
       <themes>
         <theme>

http://git-wip-us.apache.org/repos/asf/ambari/blob/9fecba83/ambari-server/src/main/resources/stacks/HDP/2.6/services/DRUID/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/DRUID/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/DRUID/metainfo.xml
index fe5ba5f..f1f099e 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/DRUID/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/DRUID/metainfo.xml
@@ -20,7 +20,7 @@
   <services>
     <service>
       <name>DRUID</name>
-      <version>0.9.2.2.6</version>
+      <version>0.9.2</version>
       <extends>common-services/DRUID/0.9.2</extends>
       <selection>TECH_PREVIEW</selection>
     </service>

http://git-wip-us.apache.org/repos/asf/ambari/blob/9fecba83/ambari-server/src/main/resources/stacks/HDP/2.6/services/FALCON/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/FALCON/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/FALCON/metainfo.xml
index b449388..fdeca9b 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/FALCON/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/FALCON/metainfo.xml
@@ -20,7 +20,7 @@
   <services>
     <service>
       <name>FALCON</name>
-      <version>0.10.0.2.6</version>
+      <version>0.10.0</version>
     </service>
   </services>
 </metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/9fecba83/ambari-server/src/main/resources/stacks/HDP/2.6/services/FLUME/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/FLUME/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/FLUME/metainfo.xml
index 0d7cd1f..59a04fd 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/FLUME/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/FLUME/metainfo.xml
@@ -20,7 +20,7 @@
   <services>
     <service>
       <name>FLUME</name>
-      <version>1.5.2.2.6</version>
+      <version>1.5.2</version>
     </service>
   </services>
 </metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/9fecba83/ambari-server/src/main/resources/stacks/HDP/2.6/services/HBASE/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/HBASE/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/HBASE/metainfo.xml
index 9bc3ee2..a6c1530 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/HBASE/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/HBASE/metainfo.xml
@@ -20,7 +20,7 @@
   <services>
     <service>
       <name>HBASE</name>
-      <version>1.1.2.2.6</version>
+      <version>1.1.2</version>
     </service>
   </services>
 </metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/9fecba83/ambari-server/src/main/resources/stacks/HDP/2.6/services/HDFS/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/HDFS/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/HDFS/metainfo.xml
index c80b2b4..f91ed8e 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/HDFS/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/HDFS/metainfo.xml
@@ -20,7 +20,7 @@
   <services>
     <service>
       <name>HDFS</name>
-      <version>2.7.3.2.6</version>
+      <version>2.7.3</version>
       <configuration-dependencies>
         <config-type>hadoop-metrics2.properties</config-type>
       </configuration-dependencies>

http://git-wip-us.apache.org/repos/asf/ambari/blob/9fecba83/ambari-server/src/main/resources/stacks/HDP/2.6/services/HIVE/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/HIVE/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/HIVE/metainfo.xml
index d0c8013..d43a535 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/HIVE/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/HIVE/metainfo.xml
@@ -20,7 +20,7 @@
   <services>
     <service>
       <name>HIVE</name>
-      <version>1.2.1.2.6</version>
+      <version>1.2.1000</version>
     </service>
     <themes>
       <theme>

http://git-wip-us.apache.org/repos/asf/ambari/blob/9fecba83/ambari-server/src/main/resources/stacks/HDP/2.6/services/KAFKA/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/KAFKA/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/KAFKA/metainfo.xml
index 047bbd2..fb28136 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/KAFKA/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/KAFKA/metainfo.xml
@@ -20,7 +20,7 @@
   <services>
     <service>
       <name>KAFKA</name>
-      <version>0.10.0.2.6</version>
+      <version>0.10.1</version>
     </service>
   </services>
 </metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/9fecba83/ambari-server/src/main/resources/stacks/HDP/2.6/services/KNOX/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/KNOX/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/KNOX/metainfo.xml
index cd7b92c..d9283e2 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/KNOX/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/KNOX/metainfo.xml
@@ -20,7 +20,7 @@
   <services>
     <service>
       <name>KNOX</name>
-      <version>0.11.0.2.6</version>
+      <version>0.12.0</version>
     </service>
   </services>
 </metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/9fecba83/ambari-server/src/main/resources/stacks/HDP/2.6/services/MAHOUT/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/MAHOUT/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/MAHOUT/metainfo.xml
index 3fe4d57..d5b0149 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/MAHOUT/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/MAHOUT/metainfo.xml
@@ -20,7 +20,7 @@
   <services>
     <service>
       <name>MAHOUT</name>
-      <version>0.9.0.2.6</version>
+      <version>0.9.0</version>
     </service>
   </services>
 </metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/9fecba83/ambari-server/src/main/resources/stacks/HDP/2.6/services/OOZIE/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/OOZIE/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/OOZIE/metainfo.xml
index 19b8bae..c9dfaad 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/OOZIE/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/OOZIE/metainfo.xml
@@ -20,7 +20,7 @@
   <services>
     <service>
       <name>OOZIE</name>
-      <version>4.2.0.2.6</version>
+      <version>4.2.0</version>
       <configuration-dependencies>
         <config-type>application-properties</config-type>
       </configuration-dependencies>

http://git-wip-us.apache.org/repos/asf/ambari/blob/9fecba83/ambari-server/src/main/resources/stacks/HDP/2.6/services/PIG/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/PIG/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/PIG/metainfo.xml
index 266aa5e..ef9e487 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/PIG/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/PIG/metainfo.xml
@@ -20,7 +20,7 @@
   <services>
     <service>
       <name>PIG</name>
-      <version>0.16.0.2.6</version>
+      <version>0.16.0</version>
     </service>
   </services>
 </metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/9fecba83/ambari-server/src/main/resources/stacks/HDP/2.6/services/RANGER/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/RANGER/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/RANGER/metainfo.xml
index 01d1cbf..3516bef 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/RANGER/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/RANGER/metainfo.xml
@@ -24,7 +24,7 @@
     <service>
       <name>RANGER</name>
       <extends>common-services/RANGER/0.7.0</extends>
-      <version>0.7.0.2.6</version>
+      <version>0.7.0</version>
     </service>
   </services>
 </metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/9fecba83/ambari-server/src/main/resources/stacks/HDP/2.6/services/RANGER_KMS/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/RANGER_KMS/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/RANGER_KMS/metainfo.xml
index 1c0a2db..bb5a8c2 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/RANGER_KMS/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/RANGER_KMS/metainfo.xml
@@ -23,7 +23,7 @@
   <services>
     <service>
       <name>RANGER_KMS</name>
-      <version>0.7.0.2.6</version>
+      <version>0.7.0</version>
     </service>
   </services>
 </metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/9fecba83/ambari-server/src/main/resources/stacks/HDP/2.6/services/SLIDER/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/SLIDER/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/SLIDER/metainfo.xml
index 692eb8a..112b6a0 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/SLIDER/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/SLIDER/metainfo.xml
@@ -20,7 +20,7 @@
   <services>
     <service>
       <name>SLIDER</name>
-      <version>0.91.0</version>
+      <version>0.92.0</version>
     </service>
   </services>
 </metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/9fecba83/ambari-server/src/main/resources/stacks/HDP/2.6/services/STORM/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/STORM/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/STORM/metainfo.xml
index 826056f..db5c8b8 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/STORM/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/STORM/metainfo.xml
@@ -21,7 +21,7 @@
   <services>
     <service>
       <name>STORM</name>
-      <version>1.0.1</version>
+      <version>1.1.0</version>
     </service>
   </services>
 </metainfo>

http://git-wip-us.apache.org/repos/asf/ambari/blob/9fecba83/ambari-server/src/main/resources/stacks/HDP/2.6/services/YARN/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/YARN/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.6/services/YARN/metainfo.xml
index 801df78..b1a5d45 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/YARN/metainfo.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/YARN/metainfo.xml
@@ -25,7 +25,7 @@
     </service>
     <service>
       <name>MAPREDUCE2</name>
-      <version>2.7.3.2.6</version>
+      <version>2.7.3</version>
       <configuration-dir>configuration-mapred</configuration-dir>
     </service>
   </services>


[03/22] ambari git commit: AMBARI-20723 Remove singleNodeInstall flag from ambari-web code. (ababiichuk)

Posted by ao...@apache.org.
AMBARI-20723 Remove singleNodeInstall flag from ambari-web code. (ababiichuk)


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

Branch: refs/heads/branch-3.0-perf
Commit: 4bc494245b8c6be05de83bd18b088c2223cc8eb4
Parents: 22e1e7e
Author: ababiichuk <ab...@hortonworks.com>
Authored: Mon Apr 10 16:55:12 2017 +0300
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Tue Apr 11 14:14:12 2017 +0300

----------------------------------------------------------------------
 ambari-web/app/assets/test/tests.js             |  1 -
 ambari-web/app/config.js                        |  2 -
 .../templates/main/service/services/oozie.hbs   | 40 --------------
 ambari-web/app/views.js                         |  1 -
 .../app/views/common/quick_view_link_view.js    |  8 ---
 .../app/views/main/service/info/summary.js      |  7 ---
 .../app/views/main/service/services/hbase.js    |  6 ---
 .../app/views/main/service/services/hdfs.js     |  4 --
 .../app/views/main/service/services/oozie.js    | 29 -----------
 .../test/views/common/quick_link_view_test.js   | 10 ----
 .../views/main/service/info/summary_test.js     | 26 ---------
 .../views/main/service/services/hbase_test.js   | 23 --------
 .../views/main/service/services/hdfs_test.js    | 20 -------
 .../views/main/service/services/oozie_test.js   | 55 --------------------
 14 files changed, 232 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/4bc49424/ambari-web/app/assets/test/tests.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/test/tests.js b/ambari-web/app/assets/test/tests.js
index ef8d0bc..432479d 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -349,7 +349,6 @@ var files = [
   'test/views/main/service/services/storm_test',
   'test/views/main/service/services/yarn_test',
   'test/views/main/service/services/hive_test',
-  'test/views/main/service/services/oozie_test',
   'test/views/main/service/services/mapreduce2_test',
   'test/views/main/service/services/zookeeper_test',
   'test/views/main/service/services/flume_test',

http://git-wip-us.apache.org/repos/asf/ambari/blob/4bc49424/ambari-web/app/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/config.js b/ambari-web/app/config.js
index 47eb788..de4b52a 100644
--- a/ambari-web/app/config.js
+++ b/ambari-web/app/config.js
@@ -45,8 +45,6 @@ App.alertGroupsUpdateInterval = 10000;
 App.clusterEnvUpdateInterval = 10000;
 App.pageReloadTime = 3600000;
 App.nnCheckpointAgeAlertThreshold = 12; // in hours
-App.singleNodeInstall = false;
-App.singleNodeAlias = document.location.hostname;
 App.minDiskSpace = 2.0; // minimum disk space required for '/' for each host before install, unit GB
 App.minDiskSpaceUsrLib = 1.0; // minimum disk space for '/usr/lib' for each host before install, unit GB
 App.healthIconClassGreen = 'glyphicon glyphicon-ok-sign'; // bootstrap icon class for healthy/started service/host/host-component

http://git-wip-us.apache.org/repos/asf/ambari/blob/4bc49424/ambari-web/app/templates/main/service/services/oozie.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/service/services/oozie.hbs b/ambari-web/app/templates/main/service/services/oozie.hbs
deleted file mode 100644
index 3706eb4..0000000
--- a/ambari-web/app/templates/main/service/services/oozie.hbs
+++ /dev/null
@@ -1,40 +0,0 @@
-{{!
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements.  See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership.  The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License.  You may obtain a copy of the License at
-*
-*     http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-}}
-
-<div class="clearfix">
-  <div class="name col-md-2">
-    <i class="pull-left glyphicon glyphicon-empty"></i>
-    {{view App.MainDashboardServiceHealthView serviceBinding="view.service"}}
-    <a {{action selectService view.service href=true}}>{{view.service.displayName}}</a>
-    {{#if view.alertsCount}}
-      <a href="#" class="label label-important" {{action "showAlertsPopup" view.service target="view.parentView"}}>
-        {{view.alertsCount}}
-      </a>
-    {{/if}}
-  </div>
-  <div class="summary span">
-    {{#each component in view.masters}}
-      <a href="#" {{action showDetails component.host}}>{{component.displayName}}</a>,
-    {{/each}}
-
-    <a href="#" {{action filterHosts view.clients.component}}>{{view.clients.title}}</a>,
-
-    <a href="{{unbound view.webUi}}" target="_blank">{{t services.oozie.webUi}}</a>
-
-  </div>
-</div>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/4bc49424/ambari-web/app/views.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views.js b/ambari-web/app/views.js
index 3ed1a37..8031434 100644
--- a/ambari-web/app/views.js
+++ b/ambari-web/app/views.js
@@ -295,7 +295,6 @@ require('views/main/service/services/mapreduce2');
 require('views/main/service/services/hbase');
 require('views/main/service/services/hive');
 require('views/main/service/services/zookeeper');
-require('views/main/service/services/oozie');
 require('views/main/service/services/flume');
 require('views/main/service/services/storm');
 require('views/main/service/services/ranger');

http://git-wip-us.apache.org/repos/asf/ambari/blob/4bc49424/ambari-web/app/views/common/quick_view_link_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/quick_view_link_view.js b/ambari-web/app/views/common/quick_view_link_view.js
index 3f3a3a3..dfaf953 100644
--- a/ambari-web/app/views/common/quick_view_link_view.js
+++ b/ambari-web/app/views/common/quick_view_link_view.js
@@ -98,7 +98,6 @@ App.QuickLinksView = Em.View.extend({
    *
    * The flags responsible for correct, up-to-date state of quick links:
    * - App.currentStackVersionNumber
-   * - App.singleNodeInstall
    * - App.router.clusterController.isHostComponentMetricsLoaded
    */
   setQuickLinks: function () {
@@ -107,7 +106,6 @@ App.QuickLinksView = Em.View.extend({
     }
   }.observes(
     'App.currentStackVersionNumber',
-    'App.singleNodeInstall',
     'App.router.clusterController.isServiceMetricsLoaded',
     'App.router.clusterController.isHostComponentMetricsLoaded',
     'App.router.clusterController.quickLinksUpdateCounter'
@@ -612,12 +610,6 @@ App.QuickLinksView = Em.View.extend({
   getHosts: function (response, serviceName) {
     //The default error message when we cannot obtain the host information for the given service
     this.set('quickLinksErrorMessage', Em.I18n.t('quick.links.error.nohosts.label').format(serviceName));
-    if (App.get('singleNodeInstall')) {
-      return [{
-        hostName: App.get('singleNodeAlias'),
-        publicHostName: App.get('singleNodeAlias')
-      }];
-    }
     var hosts = [];
     var quickLinkConfigs = App.QuickLinksConfig.find().findProperty("id", serviceName);
     if (quickLinkConfigs) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/4bc49424/ambari-web/app/views/main/service/info/summary.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/info/summary.js b/ambari-web/app/views/main/service/info/summary.js
index 551a3fd..75d4ed5 100644
--- a/ambari-web/app/views/main/service/info/summary.js
+++ b/ambari-web/app/views/main/service/info/summary.js
@@ -135,13 +135,6 @@ App.MainServiceInfoSummaryView = Em.View.extend(App.Persist, App.TimeRangeMixin,
     return result;
   }.property('controller.content'),
 
-  historyServerUI: function () {
-    var master = this.get('controller.content.hostComponents').findProperty('isMaster');
-    return App.singleNodeInstall
-      ? "http://" + App.singleNodeAlias + ":19888"
-      : "http://" + master.get("host.publicHostName") + ":19888";
-  }.property('controller.content'),
-
   /**
    * Property related to ZOOKEEPER service, is unused for other services
    * @return {Object}

http://git-wip-us.apache.org/repos/asf/ambari/blob/4bc49424/ambari-web/app/views/main/service/services/hbase.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/services/hbase.js b/ambari-web/app/views/main/service/services/hbase.js
index d2716aa..ddcb18d 100644
--- a/ambari-web/app/views/main/service/services/hbase.js
+++ b/ambari-web/app/views/main/service/services/hbase.js
@@ -67,12 +67,6 @@ App.MainDashboardServiceHbaseView = App.MainDashboardServiceView.extend({
     return this.t("dashboard.services.hbase.summary").format(this.get('service.regionServersTotal'), avgLoad);
   }.property('service.regionServersTotal', 'service.averageLoad'),
 
-  hbaseMasterWebUrl: function () {
-    if (this.get('activeMaster.host.publicHostName')) {
-      return "http://" + (App.singleNodeInstall ? App.singleNodeAlias : this.get('activeMaster.host.publicHostName')) + ":60010";
-    }
-  }.property('activeMaster'),
-
   averageLoad: function () {
     var avgLoad = this.get('service.averageLoad');
     if (isNaN(avgLoad)) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/4bc49424/ambari-web/app/views/main/service/services/hdfs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/services/hdfs.js b/ambari-web/app/views/main/service/services/hdfs.js
index 79208b9..becb75c 100644
--- a/ambari-web/app/views/main/service/services/hdfs.js
+++ b/ambari-web/app/views/main/service/services/hdfs.js
@@ -113,10 +113,6 @@ App.MainDashboardServiceHdfsView = App.MainDashboardServiceView.extend({
     return this.t('services.service.summary.notRunning');
   }.property("service.nameNodeStartTime"),
 
-  nodeWebUrl: function () {
-    return "http://" + (App.singleNodeInstall ? App.singleNodeAlias :  this.get('service.nameNode.publicHostName')) + ":50070";
-  }.property('service.nameNode'),
-
   nodeHeap: App.MainDashboardServiceView.formattedHeap('dashboard.services.hdfs.nodes.heapUsed', 'service.jvmMemoryHeapUsed', 'service.jvmMemoryHeapMax'),
 
   dfsUsedDisk: diskPart('dashboard.services.hdfs.capacityUsed', 'service.capacityTotal', 'service.capacityUsed'),

http://git-wip-us.apache.org/repos/asf/ambari/blob/4bc49424/ambari-web/app/views/main/service/services/oozie.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/services/oozie.js b/ambari-web/app/views/main/service/services/oozie.js
deleted file mode 100644
index f7a645d..0000000
--- a/ambari-web/app/views/main/service/services/oozie.js
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var App = require('app');
-
-App.MainDashboardServiceOozieView = App.MainDashboardServiceView.extend({
-  serviceName: 'oozie',
-  templateName: require('templates/main/service/services/oozie'),
-
-  webUi: function () {
-    var hostName = App.singleNodeInstall ? App.singleNodeAlias : this.get('service.hostComponents').findProperty('componentName', 'OOZIE_SERVER').get('host.publicHostName');
-    return "http://{0}:11000/oozie".format(hostName);
-  }.property('service')
-});
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/4bc49424/ambari-web/test/views/common/quick_link_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/quick_link_view_test.js b/ambari-web/test/views/common/quick_link_view_test.js
index c0d58c8..fbdb711 100644
--- a/ambari-web/test/views/common/quick_link_view_test.js
+++ b/ambari-web/test/views/common/quick_link_view_test.js
@@ -886,7 +886,6 @@ describe('App.QuickViewLinks', function () {
       sinon.stub(quickViewLinks, 'processHbaseHosts').returns(['hbaseHost']);
       sinon.stub(quickViewLinks, 'processYarnHosts').returns(['yarnHost']);
       sinon.stub(quickViewLinks, 'findHosts').returns(['host1']);
-      App.set('singleNodeInstall', false);
       sinon.stub(App.QuickLinksConfig, 'find').returns([
         Em.Object.create({
           id: 'OOZIE',
@@ -990,15 +989,6 @@ describe('App.QuickViewLinks', function () {
       App.QuickLinksConfig.find.restore();
     });
 
-    it("singleNodeInstall is true", function() {
-      App.set('singleNodeInstall', true);
-      App.set('singleNodeAlias', 'host1');
-      expect(quickViewLinks.getHosts({}, 'S1')).to.eql([{
-        hostName: 'host1',
-        publicHostName: 'host1'
-      }])
-    });
-
     var tests = [
       {
         serviceName: 'OOZIE',

http://git-wip-us.apache.org/repos/asf/ambari/blob/4bc49424/ambari-web/test/views/main/service/info/summary_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/service/info/summary_test.js b/ambari-web/test/views/main/service/info/summary_test.js
index 51fd2f2..41f2992 100644
--- a/ambari-web/test/views/main/service/info/summary_test.js
+++ b/ambari-web/test/views/main/service/info/summary_test.js
@@ -350,32 +350,6 @@ describe('App.MainServiceInfoSummaryView', function() {
     });
   });
 
-  describe("#historyServerUI", function() {
-
-    it("singleNodeInstall is true", function() {
-      App.set('singleNodeInstall', true);
-      App.set('singleNodeAlias', 'alias');
-      view.propertyDidChange('historyServerUI');
-      expect(view.get('historyServerUI')).to.equal("http://alias:19888");
-    });
-
-    it("singleNodeInstall is false", function () {
-      App.set('singleNodeInstall', false);
-      view.set('controller.content', Em.Object.create({
-        hostComponents: [
-          Em.Object.create({
-            isMaster: true,
-            host: Em.Object.create({
-              publicHostName: 'host1'
-            })
-          })
-        ]
-      }));
-      view.propertyDidChange('historyServerUI');
-      expect(view.get('historyServerUI')).to.equal("http://host1:19888");
-    });
-  });
-
   describe("#serversHost", function() {
 
     it("should return empty object", function() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/4bc49424/ambari-web/test/views/main/service/services/hbase_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/service/services/hbase_test.js b/ambari-web/test/views/main/service/services/hbase_test.js
index 6c0f1f1..f8f1941 100644
--- a/ambari-web/test/views/main/service/services/hbase_test.js
+++ b/ambari-web/test/views/main/service/services/hbase_test.js
@@ -86,27 +86,4 @@ describe('App.MainDashboardServiceHbaseView', function () {
     });
   });
 
-  describe("#hbaseMasterWebUrl", function() {
-
-    it("activeMaster is present", function() {
-      view.reopen({
-        activeMaster: Em.Object.create({
-          host: Em.Object.create({
-            publicHostName: 'host1'
-          })
-        })
-      });
-      App.set('singleNodeInstall', false);
-      view.propertyDidChange('hbaseMasterWebUrl');
-      expect(view.get('hbaseMasterWebUrl')).to.be.equal('http://host1:60010');
-    });
-    it("activeMaster is null", function() {
-      view.reopen({
-        activeMaster: null
-      });
-      view.propertyDidChange('hbaseMasterWebUrl');
-      expect(view.get('hbaseMasterWebUrl')).to.be.undefined;
-    });
-  });
-
 });
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/4bc49424/ambari-web/test/views/main/service/services/hdfs_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/service/services/hdfs_test.js b/ambari-web/test/views/main/service/services/hdfs_test.js
index 4de5f0b..f39b376 100644
--- a/ambari-web/test/views/main/service/services/hdfs_test.js
+++ b/ambari-web/test/views/main/service/services/hdfs_test.js
@@ -183,26 +183,6 @@ describe('App.MainDashboardServiceHdfsView', function () {
     });
   });
 
-  describe("#nodeWebUrl", function () {
-
-    it("singleNodeInstall is true", function () {
-      App.set('singleNodeInstall', true);
-      App.set('singleNodeAlias', 'host1');
-
-      view.propertyDidChange('nodeWebUrl');
-      expect(view.get('nodeWebUrl')).to.be.equal("http://host1:50070");
-    });
-
-    it("singleNodeInstall is false", function () {
-      App.set('singleNodeInstall', false);
-      view.set('service.nameNode', Em.Object.create({
-        publicHostName: 'host2'
-      }));
-      view.propertyDidChange('nodeWebUrl');
-      expect(view.get('nodeWebUrl')).to.be.equal("http://host2:50070");
-    });
-  });
-
   describe("#nonDfsUsed", function() {
     var testCases = [
       {

http://git-wip-us.apache.org/repos/asf/ambari/blob/4bc49424/ambari-web/test/views/main/service/services/oozie_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/service/services/oozie_test.js b/ambari-web/test/views/main/service/services/oozie_test.js
deleted file mode 100644
index c95e65f..0000000
--- a/ambari-web/test/views/main/service/services/oozie_test.js
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-var App = require('app');
-require('/views/main/service/services/oozie');
-
-describe('App.MainDashboardServiceOozieView', function () {
-  var view;
-
-  beforeEach(function() {
-    view = App.MainDashboardServiceOozieView.create();
-  });
-
-  describe("#webUi", function () {
-
-    it("singleNodeInstall is true", function () {
-      App.set('singleNodeInstall', true);
-      App.set('singleNodeAlias', 'host1');
-
-      view.propertyDidChange('webUi');
-      expect(view.get('webUi')).to.be.equal("http://host1:11000/oozie");
-    });
-
-    it("singleNodeInstall is false", function () {
-      App.set('singleNodeInstall', false);
-      view.set('service', Em.Object.create({
-        hostComponents: [
-          Em.Object.create({
-            componentName: 'OOZIE_SERVER',
-            host: Em.Object.create({
-              publicHostName: 'host2'
-            })
-          })
-        ]
-      }));
-      view.propertyDidChange('webUi');
-      expect(view.get('webUi')).to.be.equal("http://host2:11000/oozie");
-    });
-  });
-});
\ No newline at end of file


[04/22] ambari git commit: AMBARI-20551. Blueprint export fails if config-type is not mapped to any service after upgrade (Amruta Borkar via alejandro)

Posted by ao...@apache.org.
AMBARI-20551. Blueprint export fails if config-type is not mapped to any service after upgrade (Amruta Borkar via alejandro)


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

Branch: refs/heads/branch-3.0-perf
Commit: 6dba326c1202cc7e3ac6175b53591474c12f88e9
Parents: 784ceea
Author: Alejandro Fernandez <af...@hortonworks.com>
Authored: Thu Apr 6 16:32:58 2017 -0700
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Tue Apr 11 14:14:12 2017 +0300

----------------------------------------------------------------------
 .../internal/BlueprintConfigurationProcessor.java           | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6dba326c/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
index db1aa07..88a8f80 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/BlueprintConfigurationProcessor.java
@@ -517,6 +517,15 @@ public class BlueprintConfigurationProcessor {
     Map<String, Map<String, String>> properties = configuration.getFullProperties();
     for (Map.Entry<String, Map<String, String>> configEntry : properties.entrySet()) {
       String type = configEntry.getKey();
+      try {
+          clusterTopology.getBlueprint().getStack().getServiceForConfigType(type);
+        } catch (IllegalArgumentException illegalArgumentException) {
+            LOG.error(new StringBuilder(String.format("Error encountered while trying to obtain the service name for config type [%s]. ", type))
+            .append("Further processing on this config type will be skipped. ")
+            .append("This usually means that a service's definitions have been manually removed from the Ambari stack definitions. ")
+            .append("If the stack definitions have not been changed manually, this may indicate a stack definition error in Ambari. ").toString(), illegalArgumentException);
+            continue;
+        }
       Map<String, String> typeProperties = configEntry.getValue();
 
       for (Map.Entry<String, String> propertyEntry : typeProperties.entrySet()) {


[11/22] ambari git commit: AMBARI-20699. Side Nav: improve views dropdown menu.(xiwang)

Posted by ao...@apache.org.
AMBARI-20699. Side Nav: improve views dropdown menu.(xiwang)


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

Branch: refs/heads/branch-3.0-perf
Commit: 24c038c0284627fbe9a2f2f152e6d397a161640f
Parents: 6dba326
Author: Xi Wang <xi...@apache.org>
Authored: Thu Apr 6 19:31:53 2017 -0700
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Tue Apr 11 14:14:12 2017 +0300

----------------------------------------------------------------------
 .../app/styles/theme/bootstrap-ambari.css       | 36 ++++++++------------
 1 file changed, 15 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/24c038c0/ambari-web/app/styles/theme/bootstrap-ambari.css
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/theme/bootstrap-ambari.css b/ambari-web/app/styles/theme/bootstrap-ambari.css
index b063fcf..b2f5ca4 100644
--- a/ambari-web/app/styles/theme/bootstrap-ambari.css
+++ b/ambari-web/app/styles/theme/bootstrap-ambari.css
@@ -766,9 +766,16 @@ input.radio:checked + label:after {
 .navigation-bar-container ul.nav.side-nav-header li.navigation-header > a.ambari-logo > img {
   height: 25px;
   float: left;
-  margin-top: -2px;
   margin-left: -3px;
 }
+.navigation-bar-container ul.nav.side-nav-header li.navigation-header .btn-group {
+  cursor: pointer;
+  margin-top: 3px;
+}
+.navigation-bar-container ul.nav.side-nav-header li.navigation-header .btn-group:hover span.ambari-header,
+.navigation-bar-container ul.nav.side-nav-header li.navigation-header .btn-group:hover span.toggle-icon {
+  color: #fff;
+}
 .navigation-bar-container ul.nav.side-nav-header li.navigation-header .btn-group span.ambari-header {
   font-family: 'Roboto', sans-serif;
   font-weight: normal;
@@ -777,15 +784,13 @@ input.radio:checked + label:after {
   color: #333;
   font-size: 20px;
   width: 55px;
-  cursor: pointer;
   display: inline;
-  color: #fff;
+  color: #b8bec4;
   padding: 0 8px 0 10px;
 }
 .navigation-bar-container ul.nav.side-nav-header li.navigation-header .btn-group span.toggle-icon {
   margin-bottom: 5px;
   font-size: 13px;
-  cursor: pointer;
   display: inline-block;
   vertical-align: middle;
   color: #b8bec4;
@@ -795,17 +800,7 @@ input.radio:checked + label:after {
   box-shadow: none;
 }
 .navigation-bar-container ul.nav.side-nav-header li.navigation-header ul.dropdown-menu {
-  min-width: 190px;
-  max-width: 190px;
-  width: 190px;
-  right: -43px;
-  left: auto;
   top: 30px;
-  background: #323543;
-  border: none;
-}
-.navigation-bar-container ul.nav.side-nav-header li.navigation-header ul.dropdown-menu li {
-  border: none;
 }
 .navigation-bar-container ul.nav.side-nav-header li.navigation-header ul.dropdown-menu li > a {
   font-family: 'Roboto', sans-serif;
@@ -813,17 +808,15 @@ input.radio:checked + label:after {
   font-style: normal;
   line-height: 1;
   color: #333;
-  font-size: 13px;
-  color: #999;
-  padding: 15px 10px;
-  height: auto;
+  font-size: 14px;
+  color: #666;
+  line-height: 1.42;
   white-space: nowrap;
   overflow: hidden;
   text-overflow: ellipsis;
 }
 .navigation-bar-container ul.nav.side-nav-header li.navigation-header ul.dropdown-menu li > a:hover {
-  background: #404351;
-  color: #fff;
+  background: #f5f5f5;
 }
 .navigation-bar-container ul.nav.side-nav-menu,
 .navigation-bar-container ul.nav.side-nav-footer {
@@ -1139,6 +1132,7 @@ input.radio:checked + label:after {
   position: fixed;
   top: 0;
   bottom: 0;
+  left: 0;
   z-index: 2079;
 }
 .navigation-bar-fit-height .side-nav-header {
@@ -1470,4 +1464,4 @@ a.disabled:hover,
 a:visited.disabled:hover,
 a:focus.disabled:hover {
   text-decoration: none;
-}
+}
\ No newline at end of file


[20/22] ambari git commit: AMBARI-20670. Node manager start extremely slow when YARN NM local dirs are very large - ut fix (dgrinenko via echekanskiy)

Posted by ao...@apache.org.
AMBARI-20670. Node manager start extremely slow when YARN NM local dirs are very large - ut fix (dgrinenko via echekanskiy)


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

Branch: refs/heads/branch-3.0-perf
Commit: 22e1e7ebc1b6cc5af75b9e552d39c79936d89316
Parents: 40ab38e
Author: Eugene Chekanskiy <ec...@hortonworks.com>
Authored: Mon Apr 10 17:08:50 2017 +0300
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Tue Apr 11 14:14:12 2017 +0300

----------------------------------------------------------------------
 .../src/test/python/stacks/2.0.6/YARN/test_nodemanager.py      | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/22e1e7eb/ambari-server/src/test/python/stacks/2.0.6/YARN/test_nodemanager.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/YARN/test_nodemanager.py b/ambari-server/src/test/python/stacks/2.0.6/YARN/test_nodemanager.py
index 10edb4b..ab5e2cd 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/YARN/test_nodemanager.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/YARN/test_nodemanager.py
@@ -169,8 +169,7 @@ class TestNodeManager(RMFTestCase):
                               mode = 0755,
                               create_parents = True,
                               ignore_failures = True,
-                              cd_access='a',
-                              recursive_mode_flags = {'d': 'a+rwx', 'f': 'a+rw'},
+                              cd_access='a'
                               )
     self.assertResourceCalled('Directory', '/hadoop/yarn/local1',
                               owner = 'yarn',
@@ -178,8 +177,7 @@ class TestNodeManager(RMFTestCase):
                               group = 'hadoop',
                               ignore_failures = True,
                               mode = 0755,
-                              cd_access='a',
-                              recursive_mode_flags = {'d': 'a+rwx', 'f': 'a+rw'}
+                              cd_access='a'
                               )
     self.assertResourceCalled('File', '/var/lib/ambari-agent/data/yarn/yarn_local_dir_mount.hist',
         content = '\n# This file keeps track of the last known mount-point for each dir.\n# It is safe to delete, since it will get regenerated the next time that the component of the service starts.\n# However, it is not advised to delete this file since Ambari may\n# re-create a dir that used to be mounted on a drive but is now mounted on the root.\n# Comments begin with a hash (#) symbol\n# dir,mount_point\n',


[02/22] ambari git commit: AMBARI-20729.Need way to explicitly ask for workflow name(Venkata Sairam via padmapriyanitt)

Posted by ao...@apache.org.
AMBARI-20729.Need way to explicitly ask for workflow name(Venkata Sairam via padmapriyanitt)


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

Branch: refs/heads/branch-3.0-perf
Commit: 36e456bce2d92fcf6e9f43f7cdfa711782aa1147
Parents: d8dc982
Author: padmapriyanitt <pa...@gmail.com>
Authored: Tue Apr 11 15:35:26 2017 +0530
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Tue Apr 11 14:14:12 2017 +0300

----------------------------------------------------------------------
 .../src/main/resources/ui/app/components/flow-designer.js      | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/36e456bc/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js b/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
index cccf6d0..e3f3718 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/components/flow-designer.js
@@ -116,6 +116,7 @@ export default Ember.Component.extend(FindNodeMixin, Validations, {
   isDraft: false,
   jobConfigProperties: Ember.A([]),
   saveJobService : Ember.inject.service('save-job'),
+  isDefaultNameForWFEnabled : false,
   initialize : function(){
     var id = 'cy-' + Math.ceil(Math.random() * 1000);
     this.set('cyId', id);
@@ -140,7 +141,10 @@ export default Ember.Component.extend(FindNodeMixin, Validations, {
         this.restoreWorkflow();
       }
     }
-    if(Ember.isBlank(this.get('workflow.name'))){
+    /*
+       This block will enable/disable giving default name for workflow
+    */
+    if(Ember.isBlank(this.get('workflow.name')) && this.get('isDefaultNameForWFEnabled')) {
       this.set('workflow.name', Ember.copy(this.get('tabInfo.name')));
     }
   }.on('didInsertElement'),


[16/22] ambari git commit: AMBARI-20689.Zooming workflows should happen more smoothly(M Madhan Mohan Reddy via padmapriyanitt)

Posted by ao...@apache.org.
AMBARI-20689.Zooming workflows should happen more smoothly(M Madhan Mohan Reddy via padmapriyanitt)


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

Branch: refs/heads/branch-3.0-perf
Commit: 78715789f774a3ca376b13a78c8719f359d994fc
Parents: 6b9a597
Author: padmapriyanitt <pa...@gmail.com>
Authored: Mon Apr 10 12:36:38 2017 +0530
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Tue Apr 11 14:14:12 2017 +0300

----------------------------------------------------------------------
 .../src/main/resources/ui/app/domain/cytoscape-flow-renderer.js    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/78715789/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-flow-renderer.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-flow-renderer.js b/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-flow-renderer.js
index 03f0ae1..bee901e 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-flow-renderer.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-flow-renderer.js
@@ -36,7 +36,7 @@ var CytoscapeRenderer= Ember.Object.extend({
 
     // the default values of each option are outlined below:
     var defaults = {
-      zoomFactor: 2.0, // zoom factor per zoom tick
+      zoomFactor: 0.01, // zoom factor per zoom tick
       minZoom: 0.1, // min zoom level
       maxZoom: 10, // max zoom level
 


[09/22] ambari git commit: AMBARI-20693. Principal suffix field should be a non mandatory field in configure identities page of Enable kerberos wizard (akovalenko)

Posted by ao...@apache.org.
AMBARI-20693. Principal suffix field should be a non mandatory field in configure identities page of Enable kerberos wizard (akovalenko)


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

Branch: refs/heads/branch-3.0-perf
Commit: 0f406c5e6f7b908b363c17bce96955be8eb27d88
Parents: 6ec4bdb
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Thu Apr 6 20:17:55 2017 +0300
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Tue Apr 11 14:14:12 2017 +0300

----------------------------------------------------------------------
 .../app/data/configs/wizards/kerberos_descriptor_properties.js  | 5 +++++
 ambari-web/app/mixins/wizard/addSecurityConfigs.js              | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/0f406c5e/ambari-web/app/data/configs/wizards/kerberos_descriptor_properties.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/configs/wizards/kerberos_descriptor_properties.js b/ambari-web/app/data/configs/wizards/kerberos_descriptor_properties.js
index f6e4239..a6ecf20 100644
--- a/ambari-web/app/data/configs/wizards/kerberos_descriptor_properties.js
+++ b/ambari-web/app/data/configs/wizards/kerberos_descriptor_properties.js
@@ -29,6 +29,11 @@ var properties = [
     "name": "additional_realms",
     "index": 5,
     "placeholderText": "(" + Em.I18n.t("common.optional") + ")"
+  },
+  {
+    "name": "principal_suffix",
+    "index": 6,
+    "placeholderText": "(" + Em.I18n.t("common.optional") + ")"
   }
 ];
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/0f406c5e/ambari-web/app/mixins/wizard/addSecurityConfigs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/wizard/addSecurityConfigs.js b/ambari-web/app/mixins/wizard/addSecurityConfigs.js
index e8da47f..89d3cf7 100644
--- a/ambari-web/app/mixins/wizard/addSecurityConfigs.js
+++ b/ambari-web/app/mixins/wizard/addSecurityConfigs.js
@@ -204,7 +204,7 @@ App.AddSecurityConfigs = Em.Mixin.create({
     for (var propertyName in kerberosProperties) {
       var predefinedProperty = this.get('kerberosDescriptorProperties').findProperty('name', propertyName);
       var value = kerberosProperties[propertyName];
-      var isRequired = propertyName == 'additional_realms' ? false : value !== "";
+      var isRequired = ['additional_realms', 'principal_suffix'].contains(propertyName) ? false : value !== "";
       var propertyObject = {
         name: propertyName,
         value: value,


[19/22] ambari git commit: AMBARI-20673.For sort/partition operator, if there is only 1 reducer, display just 'sort' rather than 'sort/partition'(Venkata Sairam via padmapriyanitt)

Posted by ao...@apache.org.
AMBARI-20673.For sort/partition operator, if there is only 1 reducer, display just 'sort' rather than 'sort/partition'(Venkata Sairam via padmapriyanitt)


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

Branch: refs/heads/branch-3.0-perf
Commit: d8dc982ad9bd9ddfca19b1993167e6d10c0e5863
Parents: 119ad10
Author: padmapriyanitt <pa...@gmail.com>
Authored: Tue Apr 11 12:04:35 2017 +0530
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Tue Apr 11 14:14:12 2017 +0300

----------------------------------------------------------------------
 .../ui/app/utils/hive-explainer/renderer.js     | 40 ++++++++++++--------
 1 file changed, 25 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/d8dc982a/contrib/views/hive20/src/main/resources/ui/app/utils/hive-explainer/renderer.js
----------------------------------------------------------------------
diff --git a/contrib/views/hive20/src/main/resources/ui/app/utils/hive-explainer/renderer.js b/contrib/views/hive20/src/main/resources/ui/app/utils/hive-explainer/renderer.js
index 1cfcb15..78aa39d 100644
--- a/contrib/views/hive20/src/main/resources/ui/app/utils/hive-explainer/renderer.js
+++ b/contrib/views/hive20/src/main/resources/ui/app/utils/hive-explainer/renderer.js
@@ -24,7 +24,7 @@ export default function doRender(data, selector, onRequestDetail, draggable) {
   const width = '1570', height = '800';
 
   d3.select(selector).select('*').remove();
-
+  var isSingleReducer = isSingleReducerAvailable(data);
   const svg =
     d3.select(selector)
       .append('svg')
@@ -64,10 +64,10 @@ export default function doRender(data, selector, onRequestDetail, draggable) {
       .attr('data-vertex', d => d._vertex);
 
   root
-    .call(recurseC, onRequestDetail);
+    .call(recurseC, onRequestDetail, isSingleReducer);
 
   root
-    .call(recurseV, onRequestDetail);
+    .call(recurseV, onRequestDetail, isSingleReducer);
 
   container.selectAll('path.edge')
     .data(data.connections)
@@ -79,8 +79,16 @@ export default function doRender(data, selector, onRequestDetail, draggable) {
   reset(zoom, svg, container);
 
 }
-
-function recurseV(vertices, onRequestDetail) {
+function isSingleReducerAvailable(data){
+  let reducerCount = data.vertices.filter(function(item){
+    return item['_vertex'].indexOf("Reducer") === 0;
+  });
+  if(reducerCount && reducerCount.length === 1) {
+    return true;
+  }
+  return false;
+}
+function recurseV(vertices, onRequestDetail, isSingleReducer) {
   vertices.each(function(cVertx) {
     const vertex = d3.select(this);
 
@@ -95,14 +103,14 @@ function recurseV(vertices, onRequestDetail) {
         .style('transform', d => `translate(${d._widthOfSelf * 200}px, ${d._offsetY * 100}px)`);
 
       vertices
-        .call(recurseC, onRequestDetail);
+        .call(recurseC, onRequestDetail, isSingleReducer);
 
       vertices
-        .call(recurseV, onRequestDetail);
+        .call(recurseV, onRequestDetail, isSingleReducer);
   });
 }
 
-function recurseC(children, onRequestDetail) {
+function recurseC(children, onRequestDetail, isSingleReducer) {
   children.each(function(d) {
     const child = d3.select(this);
 
@@ -131,18 +139,18 @@ function recurseC(children, onRequestDetail) {
         .attr('width', 140)
           .append('xhtml:body')
         .style('margin', 0)
-          .html(d => getRenderer(d._operator)(d))
+          .html(d => getRenderer(d._operator, isSingleReducer)(d))
         .on('click', d => {
           const vertex = d3.select(Ember.$(d3.select(this).node()).closest('.vertex').get(0)).data()[0];
           onRequestDetail(doClean(d), vertex);
         });
 
       children
-        .call(recurseC, onRequestDetail);
+        .call(recurseC, onRequestDetail, isSingleReducer);
     });
 }
 
-function getRenderer(type) {
+function getRenderer(type, isSingleReducer) {
   if(type === 'Fetch Operator') {
     return (d => {
       return (`
@@ -151,7 +159,7 @@ function getRenderer(type) {
             <i class='fa ${getOperatorIcon(d._operator)}' aria-hidden='true'></i>
           </div>
           <div class='operator-body' style='margin-left: 10px;'>
-            <div>${getOperatorLabel(d)}</div>
+            <div>${getOperatorLabel(d, isSingleReducer)}</div>
             ${(d['limit:'] && d['limit:'] > -1) ? '<div><span style="font-weight: lighter;">Limit:</span> ' + d['limit:'] + ' </div>' : ''}
           </div>
         </div>
@@ -167,7 +175,7 @@ function getRenderer(type) {
           <i class='fa ${getOperatorIcon(d._operator)}' aria-hidden='true'></i>
         </div>
         <div class='operator-body' style='margin-left: 10px;'>
-          <div>${getOperatorLabel(d)}</div>
+          <div>${getOperatorLabel(d, isSingleReducer)}</div>
           ${stats}
         </div>
       </div>
@@ -180,9 +188,11 @@ function getNumberOfRows(statistics) {
   const match = statistics.match(/([^\?]*)\Num rows: (\d*)/);
   return (match.length === 3 && Number.isNaN(Number(match[2])) === false) ? match[2] : 0;
 }
-function getOperatorLabel(d) {
+function getOperatorLabel(d, isSingleReducer) {
   const operator = d._operator;
-
+  if(operator === 'Partition/Sort Pseudo-Edge' && isSingleReducer) {
+    return "Sort";
+  }
   if(operator === 'TableScan') {
     return d['alias:'];
   }


[14/22] ambari git commit: AMBARI-20695. "ambari-server upgrade" command does not change owner for all dirs.(vbrodetskyi)

Posted by ao...@apache.org.
AMBARI-20695. "ambari-server upgrade" command does not change owner for all dirs.(vbrodetskyi)


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

Branch: refs/heads/branch-3.0-perf
Commit: 9ca337ca944b26d53ec7b40fd7f5b0ce8789158e
Parents: 24c038c
Author: Vitaly Brodetskyi <vb...@hortonworks.com>
Authored: Fri Apr 7 14:28:33 2017 +0300
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Tue Apr 11 14:14:12 2017 +0300

----------------------------------------------------------------------
 .../src/main/python/ambari_server/serverConfiguration.py          | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/9ca337ca/ambari-server/src/main/python/ambari_server/serverConfiguration.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/python/ambari_server/serverConfiguration.py b/ambari-server/src/main/python/ambari_server/serverConfiguration.py
index fb016d0..7eba9db 100644
--- a/ambari-server/src/main/python/ambari_server/serverConfiguration.py
+++ b/ambari-server/src/main/python/ambari_server/serverConfiguration.py
@@ -530,6 +530,9 @@ class ServerConfigDefaultsLinux(ServerConfigDefaults):
       (AmbariPath.get("/var/lib/ambari-server/keys/.ssh"), "700", "{0}", False),
       (AmbariPath.get("/var/lib/ambari-server/resources/common-services/"), "755", "{0}", True),
       (AmbariPath.get("/var/lib/ambari-server/resources/stacks/"), "755", "{0}", True),
+      (AmbariPath.get("/var/lib/ambari-server/resources/extensions/"), "755", "{0}", True),
+      (AmbariPath.get("/var/lib/ambari-server/resources/dashboards/"), "755", "{0}", True),
+      (AmbariPath.get("/var/lib/ambari-server/resources/mpacks/"), "755", "{0}", True),
       (AmbariPath.get("/var/lib/ambari-server/resources/custom_actions/"), "755", "{0}", True),
       (AmbariPath.get("/var/lib/ambari-server/resources/host_scripts/"), "755", "{0}", True),
       (AmbariPath.get("/var/lib/ambari-server/resources/views/*"), "644", "{0}", True),


[21/22] ambari git commit: AMBARI-20704.Need a way to indicate the action node type in workflow manager.(Venkata Sairam via padmapriyanitt)

Posted by ao...@apache.org.
AMBARI-20704.Need a way to indicate the action node type in workflow manager.(Venkata Sairam via padmapriyanitt)


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

Branch: refs/heads/branch-3.0-perf
Commit: 119ad10e7680e60d90117130384db79a2d38c13e
Parents: e3794a3
Author: padmapriyanitt <pa...@gmail.com>
Authored: Tue Apr 11 11:50:56 2017 +0530
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Tue Apr 11 14:14:12 2017 +0300

----------------------------------------------------------------------
 .../main/resources/ui/app/domain/cytoscape-style.js  |  10 +++++++++-
 .../wfmanager/src/main/resources/ui/app/index.html   |  14 ++++++++++++++
 .../src/main/resources/ui/public/assets/custom.png   | Bin 0 -> 350 bytes
 .../src/main/resources/ui/public/assets/distcp.png   | Bin 0 -> 229 bytes
 .../src/main/resources/ui/public/assets/email.png    | Bin 0 -> 340 bytes
 .../src/main/resources/ui/public/assets/fs.png       | Bin 0 -> 254 bytes
 .../src/main/resources/ui/public/assets/hive.png     | Bin 0 -> 270 bytes
 .../src/main/resources/ui/public/assets/hive2.png    | Bin 0 -> 270 bytes
 .../src/main/resources/ui/public/assets/java.png     | Bin 0 -> 385 bytes
 .../main/resources/ui/public/assets/map-reduce.png   | Bin 0 -> 552 bytes
 .../src/main/resources/ui/public/assets/pig.png      | Bin 0 -> 342 bytes
 .../src/main/resources/ui/public/assets/shell.png    | Bin 0 -> 222 bytes
 .../src/main/resources/ui/public/assets/spark.png    | Bin 0 -> 381 bytes
 .../src/main/resources/ui/public/assets/sqoop.png    | Bin 0 -> 482 bytes
 .../src/main/resources/ui/public/assets/ssh.png      | Bin 0 -> 222 bytes
 .../main/resources/ui/public/assets/sub-workflow.png | Bin 0 -> 433 bytes
 16 files changed, 23 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/119ad10e/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-style.js
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-style.js b/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-style.js
index 5a85573..c685038 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-style.js
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/domain/cytoscape-style.js
@@ -28,6 +28,13 @@ var labelFunction=function(target) {
     return target.data().node.name;
   }
 };
+
+var actionNodeImage = function(target) {
+  if (target && target.data() && target.data().node && target.data().node.actionType) {
+    return 'assets/' + target.data().node.actionType + '.png';
+  }
+};
+
 export default Ember.Object.create({
   style: [
     {
@@ -100,7 +107,8 @@ export default Ember.Object.create({
     {
       selector: 'node[type = "action"]',
       style: {
-        'background-color': actionNodeColor,
+        'background-image': actionNodeImage,
+        'background-position-x': 10,
         width: 150
       }
     },

http://git-wip-us.apache.org/repos/asf/ambari/blob/119ad10e/contrib/views/wfmanager/src/main/resources/ui/app/index.html
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/app/index.html b/contrib/views/wfmanager/src/main/resources/ui/app/index.html
index df243ad..311441c 100644
--- a/contrib/views/wfmanager/src/main/resources/ui/app/index.html
+++ b/contrib/views/wfmanager/src/main/resources/ui/app/index.html
@@ -40,6 +40,20 @@
   <img src="assets/stop.png"/>
   <img src="assets/join.png"/>
   <img src="assets/sitemap.png"/>
+  <img src="assets/hive.png"/>
+  <img src="assets/hive2.png"/>
+  <img src="assets/sqoop.png"/>
+  <img src="assets/pig.png"/>
+  <img src="assets/sub-workflow.png"/>
+  <img src="assets/java.png"/>
+  <img src="assets/shell.png"/>
+  <img src="assets/distcp.png"/>
+  <img src="assets/map-reduce.png"/>
+  <img src="assets/ssh.png"/>
+  <img src="assets/spark.png"/>
+  <img src="assets/email.png"/>
+  <img src="assets/fs.png"/>
+  <img src="assets/custom.png"/>
 </div>
 
     {{content-for "body"}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/119ad10e/contrib/views/wfmanager/src/main/resources/ui/public/assets/custom.png
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/public/assets/custom.png b/contrib/views/wfmanager/src/main/resources/ui/public/assets/custom.png
new file mode 100644
index 0000000..3ff3156
Binary files /dev/null and b/contrib/views/wfmanager/src/main/resources/ui/public/assets/custom.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/119ad10e/contrib/views/wfmanager/src/main/resources/ui/public/assets/distcp.png
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/public/assets/distcp.png b/contrib/views/wfmanager/src/main/resources/ui/public/assets/distcp.png
new file mode 100644
index 0000000..c377f82
Binary files /dev/null and b/contrib/views/wfmanager/src/main/resources/ui/public/assets/distcp.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/119ad10e/contrib/views/wfmanager/src/main/resources/ui/public/assets/email.png
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/public/assets/email.png b/contrib/views/wfmanager/src/main/resources/ui/public/assets/email.png
new file mode 100644
index 0000000..a7d9f98
Binary files /dev/null and b/contrib/views/wfmanager/src/main/resources/ui/public/assets/email.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/119ad10e/contrib/views/wfmanager/src/main/resources/ui/public/assets/fs.png
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/public/assets/fs.png b/contrib/views/wfmanager/src/main/resources/ui/public/assets/fs.png
new file mode 100644
index 0000000..1dd73ce
Binary files /dev/null and b/contrib/views/wfmanager/src/main/resources/ui/public/assets/fs.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/119ad10e/contrib/views/wfmanager/src/main/resources/ui/public/assets/hive.png
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/public/assets/hive.png b/contrib/views/wfmanager/src/main/resources/ui/public/assets/hive.png
new file mode 100644
index 0000000..91dfead
Binary files /dev/null and b/contrib/views/wfmanager/src/main/resources/ui/public/assets/hive.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/119ad10e/contrib/views/wfmanager/src/main/resources/ui/public/assets/hive2.png
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/public/assets/hive2.png b/contrib/views/wfmanager/src/main/resources/ui/public/assets/hive2.png
new file mode 100644
index 0000000..91dfead
Binary files /dev/null and b/contrib/views/wfmanager/src/main/resources/ui/public/assets/hive2.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/119ad10e/contrib/views/wfmanager/src/main/resources/ui/public/assets/java.png
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/public/assets/java.png b/contrib/views/wfmanager/src/main/resources/ui/public/assets/java.png
new file mode 100644
index 0000000..ef23574
Binary files /dev/null and b/contrib/views/wfmanager/src/main/resources/ui/public/assets/java.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/119ad10e/contrib/views/wfmanager/src/main/resources/ui/public/assets/map-reduce.png
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/public/assets/map-reduce.png b/contrib/views/wfmanager/src/main/resources/ui/public/assets/map-reduce.png
new file mode 100644
index 0000000..69b034a
Binary files /dev/null and b/contrib/views/wfmanager/src/main/resources/ui/public/assets/map-reduce.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/119ad10e/contrib/views/wfmanager/src/main/resources/ui/public/assets/pig.png
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/public/assets/pig.png b/contrib/views/wfmanager/src/main/resources/ui/public/assets/pig.png
new file mode 100644
index 0000000..15a65fa
Binary files /dev/null and b/contrib/views/wfmanager/src/main/resources/ui/public/assets/pig.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/119ad10e/contrib/views/wfmanager/src/main/resources/ui/public/assets/shell.png
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/public/assets/shell.png b/contrib/views/wfmanager/src/main/resources/ui/public/assets/shell.png
new file mode 100644
index 0000000..43b431d
Binary files /dev/null and b/contrib/views/wfmanager/src/main/resources/ui/public/assets/shell.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/119ad10e/contrib/views/wfmanager/src/main/resources/ui/public/assets/spark.png
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/public/assets/spark.png b/contrib/views/wfmanager/src/main/resources/ui/public/assets/spark.png
new file mode 100644
index 0000000..23a9043
Binary files /dev/null and b/contrib/views/wfmanager/src/main/resources/ui/public/assets/spark.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/119ad10e/contrib/views/wfmanager/src/main/resources/ui/public/assets/sqoop.png
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/public/assets/sqoop.png b/contrib/views/wfmanager/src/main/resources/ui/public/assets/sqoop.png
new file mode 100644
index 0000000..70fb58e
Binary files /dev/null and b/contrib/views/wfmanager/src/main/resources/ui/public/assets/sqoop.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/119ad10e/contrib/views/wfmanager/src/main/resources/ui/public/assets/ssh.png
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/public/assets/ssh.png b/contrib/views/wfmanager/src/main/resources/ui/public/assets/ssh.png
new file mode 100644
index 0000000..43b431d
Binary files /dev/null and b/contrib/views/wfmanager/src/main/resources/ui/public/assets/ssh.png differ

http://git-wip-us.apache.org/repos/asf/ambari/blob/119ad10e/contrib/views/wfmanager/src/main/resources/ui/public/assets/sub-workflow.png
----------------------------------------------------------------------
diff --git a/contrib/views/wfmanager/src/main/resources/ui/public/assets/sub-workflow.png b/contrib/views/wfmanager/src/main/resources/ui/public/assets/sub-workflow.png
new file mode 100644
index 0000000..83cfeb7
Binary files /dev/null and b/contrib/views/wfmanager/src/main/resources/ui/public/assets/sub-workflow.png differ


[08/22] ambari git commit: AMBARI-20685 - Upgrade Progress Dialog Executes Query Which Causes StackOverflow in JPA (jonathanhurley)

Posted by ao...@apache.org.
AMBARI-20685 - Upgrade Progress Dialog Executes Query Which Causes StackOverflow in JPA (jonathanhurley)


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

Branch: refs/heads/branch-3.0-perf
Commit: 6ec4bdbd0595791051759bd6bdb61c381e64ebea
Parents: 9fecba8
Author: Jonathan Hurley <jh...@hortonworks.com>
Authored: Wed Apr 5 16:29:22 2017 -0400
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Tue Apr 11 14:14:12 2017 +0300

----------------------------------------------------------------------
 .../internal/StageResourceProvider.java         |  4 +-
 .../internal/UpgradeItemResourceProvider.java   | 61 +++++++++-----------
 .../ambari/server/orm/entities/StageEntity.java | 19 +++---
 .../server/orm/entities/StageEntityPK.java      | 35 +++++------
 .../ambari/server/state/UpgradeHelper.java      | 48 ---------------
 5 files changed, 55 insertions(+), 112 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6ec4bdbd/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java
index 8759844..db9a0e2 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/StageResourceProvider.java
@@ -216,7 +216,7 @@ public class StageResourceProvider extends AbstractControllerResourceProvider im
 
     List<StageEntity> entities = dao.findAll(request, predicate);
     for (StageEntity entity : entities) {
-      results.add(toResource(cache, entity, propertyIds));
+      results.add(StageResourceProvider.toResource(cache, entity, propertyIds));
     }
 
     cache.clear();
@@ -273,7 +273,7 @@ public class StageResourceProvider extends AbstractControllerResourceProvider im
    *
    * @return the new resource
    */
-  private Resource toResource(
+  static Resource toResource(
       Map<Long, Map<Long, HostRoleCommandStatusSummaryDTO>> cache,
       StageEntity entity,
       Set<String> requestedIds) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/6ec4bdbd/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeItemResourceProvider.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeItemResourceProvider.java b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeItemResourceProvider.java
index bf0fa33..21b6c64 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeItemResourceProvider.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/internal/UpgradeItemResourceProvider.java
@@ -41,6 +41,8 @@ import org.apache.ambari.server.controller.spi.Resource;
 import org.apache.ambari.server.controller.spi.SystemException;
 import org.apache.ambari.server.controller.spi.UnsupportedPropertyException;
 import org.apache.ambari.server.controller.utilities.PropertyHelper;
+import org.apache.ambari.server.orm.dao.HostRoleCommandDAO;
+import org.apache.ambari.server.orm.dao.HostRoleCommandStatusSummaryDTO;
 import org.apache.ambari.server.orm.dao.StageDAO;
 import org.apache.ambari.server.orm.dao.UpgradeDAO;
 import org.apache.ambari.server.orm.entities.StageEntity;
@@ -53,7 +55,6 @@ import org.apache.ambari.server.security.authorization.AuthorizationHelper;
 import org.apache.ambari.server.security.authorization.ResourceType;
 import org.apache.ambari.server.security.authorization.RoleAuthorization;
 import org.apache.ambari.server.state.Cluster;
-import org.apache.ambari.server.state.UpgradeHelper;
 import org.apache.ambari.server.utils.SecretReference;
 import org.apache.commons.lang.StringUtils;
 
@@ -84,12 +85,8 @@ public class UpgradeItemResourceProvider extends ReadOnlyResourceProvider {
   @Inject
   private static StageDAO s_stageDao;
 
-  /**
-   * Used to generated the correct tasks and stages during an upgrade.
-   */
   @Inject
-  private static UpgradeHelper s_upgradeHelper;
-
+  private static HostRoleCommandDAO s_hostRoleCommandDAO;
 
   static {
     // properties
@@ -232,38 +229,36 @@ public class UpgradeItemResourceProvider extends ReadOnlyResourceProvider {
         }
       }
 
+      Map<Long, HostRoleCommandStatusSummaryDTO> requestAggregateCounts = s_hostRoleCommandDAO.findAggregateCounts(requestId);
+      Map<Long, Map<Long, HostRoleCommandStatusSummaryDTO>> cache = new HashMap<>();
+      cache.put(requestId, requestAggregateCounts);
+
       // !!! need to do some lookup for stages, so use a stageid -> resource for
       // when that happens
-      Map<Long, Resource> resultMap = new HashMap<>();
-
       for (UpgradeItemEntity entity : entities) {
-        Resource r = toResource(entity, requestPropertyIds);
-        resultMap.put(entity.getStageId(), r);
-      }
-
-      if (!resultMap.isEmpty()) {
-        if (null != clusterName) {
-          Set<Resource> stages = s_upgradeHelper.getStageResources(clusterName,
-              requestId, new ArrayList<>(resultMap.keySet()));
-
-          for (Resource stage : stages) {
-            Long l = (Long) stage.getPropertyValue(StageResourceProvider.STAGE_STAGE_ID);
-
-            Resource r = resultMap.get(l);
-            if (null != r) {
-              for (String propertyId : StageResourceProvider.PROPERTY_IDS) {
-                // Attempt to mask any passwords in fields that are property maps.
-                Object value = stage.getPropertyValue(propertyId);
-                if (StageResourceProvider.PROPERTIES_TO_MASK_PASSWORD_IN.contains(propertyId) &&
-                    value.getClass().equals(String.class) && !StringUtils.isBlank((String) value)) {
-                  value = SecretReference.maskPasswordInPropertyMap((String) value);
-                }
-                setResourceProperty(r, STAGE_MAPPED_IDS.get(propertyId), value, requestPropertyIds);
-              }
-            }
+        Resource upgradeItemResource = toResource(entity, requestPropertyIds);
+
+        StageEntityPK stagePrimaryKey = new StageEntityPK();
+        stagePrimaryKey.setRequestId(requestId);
+        stagePrimaryKey.setStageId(entity.getStageId());
+
+        StageEntity stageEntity = s_stageDao.findByPK(stagePrimaryKey);
+        Resource stageResource = StageResourceProvider.toResource(cache, stageEntity,
+            StageResourceProvider.PROPERTY_IDS);
+
+        for (String propertyId : StageResourceProvider.PROPERTY_IDS) {
+          // Attempt to mask any passwords in fields that are property maps.
+          Object value = stageResource.getPropertyValue(propertyId);
+          if (StageResourceProvider.PROPERTIES_TO_MASK_PASSWORD_IN.contains(propertyId)
+              && value.getClass().equals(String.class) && !StringUtils.isBlank((String) value)) {
+            value = SecretReference.maskPasswordInPropertyMap((String) value);
           }
+
+          setResourceProperty(upgradeItemResource, STAGE_MAPPED_IDS.get(propertyId), value,
+              requestPropertyIds);
         }
-        results.addAll(resultMap.values());
+
+        results.add(upgradeItemResource);
       }
     }
     return results;

http://git-wip-us.apache.org/repos/asf/ambari/blob/6ec4bdbd/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntity.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntity.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntity.java
index 49c1594..d035729 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntity.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntity.java
@@ -43,43 +43,42 @@ import org.apache.ambari.server.actionmanager.HostRoleStatus;
 
 @Entity
 @Table(name = "stage")
-@IdClass(org.apache.ambari.server.orm.entities.StageEntityPK.class)
+@IdClass(StageEntityPK.class)
 @NamedQueries({
     @NamedQuery(
         name = "StageEntity.findFirstStageByStatus",
         query = "SELECT stage.requestId, MIN(stage.stageId) from StageEntity stage, HostRoleCommandEntity hrc WHERE hrc.status IN :statuses AND hrc.stageId = stage.stageId AND hrc.requestId = stage.requestId GROUP by stage.requestId ORDER BY stage.requestId"),
     @NamedQuery(
-        name = "StageEntity.findByPK",
-        query = "SELECT stage from StageEntity stage WHERE stage.requestId = :requestId AND stage.stageId = :stageId"),
-    @NamedQuery(
         name = "StageEntity.findByRequestIdAndCommandStatuses",
         query = "SELECT stage from StageEntity stage WHERE stage.status IN :statuses AND stage.requestId = :requestId ORDER BY stage.stageId") })
 public class StageEntity {
 
-  @Column(name = "cluster_id", updatable = false, nullable = false)
   @Basic
+  @Column(name = "cluster_id", updatable = false, nullable = false)
   private Long clusterId = Long.valueOf(-1L);
 
-  @Column(name = "request_id", insertable = false, updatable = false, nullable = false)
   @Id
+  @Column(name = "request_id", insertable = false, updatable = false, nullable = false)
   private Long requestId;
 
-  @Column(name = "stage_id", nullable = false)
   @Id
+  @Column(name = "stage_id", insertable = true, updatable = false, nullable = false)
   private Long stageId = 0L;
 
+  @Basic
   @Column(name = "skippable", nullable = false)
   private Integer skippable = Integer.valueOf(0);
 
+  @Basic
   @Column(name = "supports_auto_skip_failure", nullable = false)
   private Integer supportsAutoSkipOnFailure = Integer.valueOf(0);
 
-  @Column(name = "log_info")
   @Basic
+  @Column(name = "log_info")
   private String logInfo = "";
 
-  @Column(name = "request_context")
   @Basic
+  @Column(name = "request_context")
   private String requestContext = "";
 
   @Basic
@@ -107,8 +106,8 @@ public class StageEntity {
   @Basic(fetch = FetchType.LAZY)
   private byte[] commandParamsStage;
 
-  @Column(name = "host_params")
   @Basic
+  @Column(name = "host_params")
   private byte[] hostParamsStage;
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/6ec4bdbd/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntityPK.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntityPK.java b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntityPK.java
index 34d175c..c0ccc65 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntityPK.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/orm/entities/StageEntityPK.java
@@ -19,16 +19,15 @@
 package org.apache.ambari.server.orm.entities;
 
 import java.io.Serializable;
+import java.util.Objects;
 
-import javax.persistence.Column;
-import javax.persistence.Id;
+import org.apache.commons.lang.builder.EqualsBuilder;
 
 @SuppressWarnings("serial")
 public class StageEntityPK implements Serializable {
   private Long requestId;
+  private Long stageId;
 
-  @Id
-  @Column(name = "request_id")
   public Long getRequestId() {
     return requestId;
   }
@@ -37,10 +36,6 @@ public class StageEntityPK implements Serializable {
     this.requestId = requestId;
   }
 
-  private Long stageId;
-
-  @Id
-  @Column(name = "stage_id")
   public Long getStageId() {
     return stageId;
   }
@@ -50,23 +45,25 @@ public class StageEntityPK implements Serializable {
   }
 
   @Override
-  public boolean equals(Object o) {
-    if (this == o) return true;
-    if (o == null || getClass() != o.getClass()) return false;
-
-    StageEntityPK that = (StageEntityPK) o;
+  public boolean equals(Object object) {
+    if (this == object) {
+      return true;
+    }
 
-    if (requestId != null ? !requestId.equals(that.requestId) : that.requestId != null) return false;
-    if (stageId != null ? !stageId.equals(that.stageId) : that.stageId != null) return false;
+    if (object == null || getClass() != object.getClass()) {
+      return false;
+    }
 
-    return true;
+    StageEntityPK that = (StageEntityPK) object;
+    EqualsBuilder equalsBuilder = new EqualsBuilder();
+    equalsBuilder.append(requestId, that.requestId);
+    equalsBuilder.append(stageId, that.stageId);
+    return equalsBuilder.isEquals();
   }
 
   @Override
   public int hashCode() {
-    int result = requestId != null ? requestId.hashCode() : 0;
-    result = 31 * result + (stageId != null ? stageId.hashCode() : 0);
-    return result;
+    return Objects.hash(requestId, stageId);
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/6ec4bdbd/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java b/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java
index eee913a..5a8c25e 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/UpgradeHelper.java
@@ -30,7 +30,6 @@ import java.util.regex.Pattern;
 
 import org.apache.ambari.server.AmbariException;
 import org.apache.ambari.server.api.services.AmbariMetaInfo;
-import org.apache.ambari.server.controller.internal.StageResourceProvider;
 import org.apache.ambari.server.controller.internal.TaskResourceProvider;
 import org.apache.ambari.server.controller.predicate.AndPredicate;
 import org.apache.ambari.server.controller.spi.ClusterController;
@@ -667,53 +666,6 @@ public class UpgradeHelper {
   }
 
   /**
-   * Gets a set of Stages resources to aggregate an UpgradeItem with Stage.
-   *
-   * @param clusterName the cluster name
-   * @param requestId the request id containing the stages
-   * @param stageIds the list of stages to fetch
-   * @return the list of Stage resources
-   * @throws UnsupportedPropertyException
-   * @throws NoSuchResourceException
-   * @throws NoSuchParentResourceException
-   * @throws SystemException
-   */
-  // !!! FIXME this feels very wrong
-  public Set<Resource> getStageResources(String clusterName, Long requestId, List<Long> stageIds)
-      throws UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException, SystemException {
-    ClusterController clusterController = ClusterControllerHelper.getClusterController();
-
-    Request request = PropertyHelper.getReadRequest();
-
-
-    Predicate p1 = new PredicateBuilder().property(StageResourceProvider.STAGE_CLUSTER_NAME).equals(clusterName).toPredicate();
-    Predicate p2 = new PredicateBuilder().property(StageResourceProvider.STAGE_REQUEST_ID).equals(requestId).toPredicate();
-    Predicate p3 = null;
-
-    if (1 == stageIds.size()) {
-      p3 = new PredicateBuilder().property(StageResourceProvider.STAGE_STAGE_ID).equals(stageIds.get(0)).toPredicate();
-    } else if (stageIds.size() > 0) {
-      PredicateBuilder pb = new PredicateBuilder();
-
-      int i = 0;
-      for (Long stageId : stageIds) {
-        if (i++ < stageIds.size()-1) {
-          pb = pb.property(StageResourceProvider.STAGE_STAGE_ID).equals(stageId).or();
-        } else {
-          pb.property(StageResourceProvider.STAGE_STAGE_ID).equals(stageId);
-        }
-      }
-
-      p3 = pb.toPredicate();
-    }
-
-    QueryResponse response = clusterController.getResources(Resource.Type.Stage,
-        request, new AndPredicate(p1, p2, p3));
-
-    return response.getResources();
-  }
-
-  /**
    * Get a single resource for the task with the given parameters.
    * @param clusterName Cluster Name
    * @param requestId Request Id


[10/22] ambari git commit: AMBARI-20692. Add Ability to Pause An Upgrade In Progress (alexantonenko)

Posted by ao...@apache.org.
AMBARI-20692. Add Ability to Pause An Upgrade In Progress (alexantonenko)


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

Branch: refs/heads/branch-3.0-perf
Commit: 532ab597b439be54cde5de21ea35340dee0e3587
Parents: 0f406c5
Author: Alex Antonenko <hi...@gmail.com>
Authored: Thu Apr 6 19:07:15 2017 +0300
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Tue Apr 11 14:14:12 2017 +0300

----------------------------------------------------------------------
 ambari-web/app/routes/stack_upgrade_routes.js   |  2 +-
 .../stack_upgrade/stack_upgrade_wizard.hbs      | 47 ++++++++------------
 ambari-web/test/views/main/service/menu_test.js | 10 ++---
 .../test/views/main/service/service_test.js     |  2 -
 4 files changed, 22 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/532ab597/ambari-web/app/routes/stack_upgrade_routes.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/stack_upgrade_routes.js b/ambari-web/app/routes/stack_upgrade_routes.js
index ea40a1b..42dc4dd 100644
--- a/ambari-web/app/routes/stack_upgrade_routes.js
+++ b/ambari-web/app/routes/stack_upgrade_routes.js
@@ -22,7 +22,7 @@ module.exports = App.WizardRoute.extend({
   route: 'stack/upgrade',
 
   breadcrumbs: {
-    label: 'App.router.mainAdminStackAndUpgradeController.wizardModalTitle'
+    labelBindingPath: 'App.router.mainAdminStackAndUpgradeController.wizardModalTitle'
   },
 
   enter: function (router) {

http://git-wip-us.apache.org/repos/asf/ambari/blob/532ab597/ambari-web/app/templates/main/admin/stack_upgrade/stack_upgrade_wizard.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/stack_upgrade/stack_upgrade_wizard.hbs b/ambari-web/app/templates/main/admin/stack_upgrade/stack_upgrade_wizard.hbs
index f82cca4..f6be5d1 100644
--- a/ambari-web/app/templates/main/admin/stack_upgrade/stack_upgrade_wizard.hbs
+++ b/ambari-web/app/templates/main/admin/stack_upgrade/stack_upgrade_wizard.hbs
@@ -38,6 +38,15 @@
   <div class="task-list scrollable-block task-list-main-wrap">
     {{#if view.isLoaded}}
       <div>
+        <div class="row">
+          {{#if isDowngrade}}
+            <button
+              class="btn btn-default" {{action confirmPauseDowngrade target="view"}}>{{t admin.stackUpgrade.pauseDowngrade}}</button>
+          {{else}}
+            <button
+              class="btn btn-default" {{action confirmPauseUpgrade target="view"}}>{{t admin.stackUpgrade.pauseUpgrade}}</button>
+          {{/if}}
+        </div>
         {{#if view.runningItem}}
           <div class="panel panel-default details-box row">
             <div class="row col-md-12">
@@ -80,11 +89,6 @@
                   {{#if view.isDowngradeAvailable}}
                     <button class="btn btn-danger" {{bindAttr disabled="controller.requestInProgress"}} {{action confirmDowngrade view.failedItem target="controller"}}>{{t common.downgrade}}</button>
                   {{/if}}
-                  {{#if isDowngrade}}
-                    <button class="btn btn-default" {{action confirmPauseDowngrade target="view"}}>{{t admin.stackUpgrade.pauseDowngrade}}</button>
-                  {{else}}
-                    <button class="btn btn-default" {{action confirmPauseUpgrade target="view"}}>{{t admin.stackUpgrade.pauseUpgrade}}</button>
-                  {{/if}}
                   {{#if view.failedItem.skippable}}
                     <button class="btn btn-warning" {{bindAttr disabled="controller.requestInProgress"}} {{action continue view.failedItem target="view"}}>{{t admin.stackUpgrade.dialog.continue}}</button>
                   {{/if}}
@@ -107,14 +111,9 @@
               {{#if view.isDowngradeAvailable}}
                 <button class="btn btn-danger" {{bindAttr disabled="controller.requestInProgress"}} {{action confirmDowngrade view.manualItem target="controller"}}>{{t common.downgrade}}</button>
               {{/if}}
-              {{#if isDowngrade}}
-                <button class="btn btn-default" {{action confirmPauseDowngrade target="view"}}>{{t admin.stackUpgrade.pauseDowngrade}}</button>
-              {{else}}
-                <button class="btn btn-default" {{action confirmPauseUpgrade target="view"}}>{{t admin.stackUpgrade.pauseUpgrade}}</button>
-              {{/if}}
-                <button class="btn btn-success" {{bindAttr disabled="view.isManualProceedDisabled"}} {{action complete view.manualItem target="view"}}>
-                  {{t common.proceed}}
-                </button>
+              <button class="btn btn-success" {{bindAttr disabled="view.isManualProceedDisabled"}} {{action complete view.manualItem target="view"}}>
+                {{t common.proceed}}
+              </button>
             </div>
           </div>
         {{/if}}
@@ -187,17 +186,12 @@
               {{#if view.isDowngradeAvailable}}
                 <button class="btn btn-danger" {{bindAttr disabled="controller.requestInProgress"}} {{action confirmDowngrade view.manualItem target="controller"}}>{{t common.downgrade}}</button>
               {{/if}}
-              {{#if isDowngrade}}
-                <button class="btn btn-default" {{action confirmPauseDowngrade target="view"}}>{{t admin.stackUpgrade.pauseDowngrade}}</button>
-              {{else}}
-                <button class="btn btn-default" {{action confirmPauseUpgrade target="view"}}>{{t admin.stackUpgrade.pauseUpgrade}}</button>
-              {{/if}}
               {{#if view.isHoldingState}}
                 <button class="btn btn-default" {{bindAttr disabled="controller.requestInProgress"}} {{action retry view.failedItem target="view"}}>{{t common.retry}}</button>
               {{else}}
-                <button class="btn btn-success" {{bindAttr disabled="view.isManualProceedDisabled"}} {{action complete view.manualItem target="view"}}>
-                  {{t common.proceed}}
-                </button>
+              <button class="btn btn-success" {{bindAttr disabled="view.isManualProceedDisabled"}} {{action complete view.manualItem target="view"}}>
+                {{t common.proceed}}
+              </button>
               {{/if}}
             </div>
           </div>
@@ -249,14 +243,9 @@
               {{#if view.isDowngradeAvailable}}
                   <button class="btn btn-danger" {{bindAttr disabled="controller.requestInProgress"}} {{action confirmDowngrade view.manualItem target="controller"}}>{{t common.downgrade}}</button>
               {{/if}}
-              {{#if isDowngrade}}
-                <button class="btn btn-default" {{action confirmPauseDowngrade target="view"}}>{{t admin.stackUpgrade.pauseDowngrade}}</button>
-              {{else}}
-                <button class="btn btn-default" {{action confirmPauseUpgrade target="view"}}>{{t admin.stackUpgrade.pauseUpgrade}}</button>
-              {{/if}}
-                <button class="btn btn-success" {{bindAttr disabled="view.isManualProceedDisabled"}} {{action complete view.manualItem target="view"}}>
-                  {{t common.proceed}}
-                </button>
+              <button class="btn btn-success" {{bindAttr disabled="view.isManualProceedDisabled"}} {{action complete view.manualItem target="view"}}>
+                {{t common.proceed}}
+              </button>
             </div>
           </div>
         {{/if}}

http://git-wip-us.apache.org/repos/asf/ambari/blob/532ab597/ambari-web/test/views/main/service/menu_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/service/menu_test.js b/ambari-web/test/views/main/service/menu_test.js
index f925f2c..6295b63 100644
--- a/ambari-web/test/views/main/service/menu_test.js
+++ b/ambari-web/test/views/main/service/menu_test.js
@@ -19,10 +19,6 @@
 var App = require('app');
 require('views/main/service/menu');
 
-function getView() {
-  return App.MainServiceMenuView.create();
-}
-
 function getItemViewClass() {
   return App.MainServiceMenuView.create().get('itemViewClass').create({
     content: Em.Object.create(),
@@ -112,7 +108,7 @@ describe('App.MainServiceMenuView', function () {
         itemView.set('parentView.activeServiceId', 'S1');
         expect(itemView.get('active')).to.be.equal('active');
       });
-      it('should return "active" ', function() {
+      it('should not return "active" ', function() {
         itemView.set('content.id', 'S1');
         itemView.set('parentView.activeServiceId', 'S2');
         expect(itemView.get('active')).to.be.empty;
@@ -168,13 +164,13 @@ describe('App.MainServiceMenuView', function () {
         App.router.transitionTo.restore();
       });
 
-      it('App.router.set should be called', function() {
+      it('App.router.set should be called (routeToConfigs true)', function() {
         expect(App.router.set.calledWith('mainServiceItemController.routeToConfigs', true)).to.be.true;
       });
       it('App.router.transitionTo should be called', function() {
         expect(App.router.transitionTo.calledWith('services.service.configs', Em.Object.create())).to.be.true;
       });
-      it('App.router.set should be called', function() {
+      it('App.router.set should be called (routeToConfigs false)', function() {
         expect(App.router.set.calledWith('mainServiceItemController.routeToConfigs', false)).to.be.true;
       });
     });

http://git-wip-us.apache.org/repos/asf/ambari/blob/532ab597/ambari-web/test/views/main/service/service_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/service/service_test.js b/ambari-web/test/views/main/service/service_test.js
index 72c2f3e..fec2540 100644
--- a/ambari-web/test/views/main/service/service_test.js
+++ b/ambari-web/test/views/main/service/service_test.js
@@ -18,8 +18,6 @@
 
 var App = require('app');
 require('views/main/service/service');
-var testHelpers = require('test/helpers');
-
 
 describe('App.MainDashboardServiceHealthView', function () {
   var view;


[22/22] ambari git commit: AMBARI-20721. Add stab registering and heartbeating routine via stomp async calls. (aonishuk)

Posted by ao...@apache.org.
AMBARI-20721. Add stab registering and heartbeating routine via stomp async calls. (aonishuk)


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

Branch: refs/heads/branch-3.0-perf
Commit: 2f20b2ed2e6663037b3301f52c2a92cd98d526fe
Parents: 73eff12
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Tue Apr 11 14:14:14 2017 +0300
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Tue Apr 11 14:14:14 2017 +0300

----------------------------------------------------------------------
 .../src/main/python/ambari_agent/Constants.py   |  3 +-
 .../main/python/ambari_agent/HeartbeatThread.py | 87 ++++++++++++++++++++
 .../src/main/python/ambari_agent/Utils.py       | 37 +++++++++
 .../listeners/ServerResponsesListener.py        | 39 +++++++++
 .../listeners/TopologyEventListener.py          | 25 ++++++
 .../python/ambari_agent/listeners/__init__.py   | 18 ++++
 .../src/main/python/ambari_agent/security.py    | 38 ++++++++-
 .../ambari_agent/TestAgentStompResponses.py     | 70 +++++++++++++++-
 .../dummy_files/stomp/heartbeat_request.json    |  3 +
 .../test/python/coilmq/server/socket_server.py  |  3 +
 10 files changed, 317 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/2f20b2ed/ambari-agent/src/main/python/ambari_agent/Constants.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/Constants.py b/ambari-agent/src/main/python/ambari_agent/Constants.py
index 6b80f00..0ff9eb9 100644
--- a/ambari-agent/src/main/python/ambari_agent/Constants.py
+++ b/ambari-agent/src/main/python/ambari_agent/Constants.py
@@ -18,4 +18,5 @@ See the License for the specific language governing permissions and
 limitations under the License.
 '''
 
-AGENT_TMP_DIR = "/var/lib/ambari-agent/tmp"
\ No newline at end of file
+AGENT_TMP_DIR = "/var/lib/ambari-agent/tmp"
+CORRELATION_ID_STRING = 'correlationId'
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/2f20b2ed/ambari-agent/src/main/python/ambari_agent/HeartbeatThread.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/HeartbeatThread.py b/ambari-agent/src/main/python/ambari_agent/HeartbeatThread.py
new file mode 100644
index 0000000..2c2f9d8
--- /dev/null
+++ b/ambari-agent/src/main/python/ambari_agent/HeartbeatThread.py
@@ -0,0 +1,87 @@
+#!/usr/bin/env python
+
+'''
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+'''
+
+import json
+import time
+import logging
+import ambari_stomp
+import threading
+import security
+
+from ambari_agent.listeners.ServerResponsesListener import ServerResponsesListener
+
+HEARTBEAT_ENDPOINT = '/agent/heartbeat'
+REGISTRATION_ENDPOINT = '/agent/registration'
+SERVER_RESPONSES_ENDPOINT = '/user'
+HEARTBEAT_INTERVAL = 10
+
+logger = logging.getLogger(__name__)
+
+class HeartbeatThread(threading.Thread):
+  """
+  This thread handles registration and heartbeating routine.
+  """
+  def __init__(self):
+    threading.Thread.__init__(self)
+    self.stomp_connector = security.StompConnector()
+    self.is_registered = False
+    self.heartbeat_interval = HEARTBEAT_INTERVAL
+    self._stop = threading.Event()
+
+  def run(self):
+    while not self._stop.is_set():
+      try:
+        if not self.is_registered:
+          self.register()
+
+        heartbeat_body = self.get_heartbeat_body()
+        logger.debug("Heartbeat body is {0}".format(heartbeat_body))
+        response = self.blocking_request(heartbeat_body, HEARTBEAT_ENDPOINT)
+        logger.debug("Heartbeat response is {0}".format(response))
+
+        time.sleep(self.heartbeat_interval)
+        # TODO STOMP: handle heartbeat reponse
+      except:
+        logger.exception("Exception in HeartbeatThread. Re-running the registration")
+        # TODO STOMP: re-connect here
+        self.is_registered = False
+        pass
+
+  def blocking_request(self, body, destination):
+    self.stomp_connector.send(body=json.dumps(body), destination=destination)
+    return self.server_responses_listener.responses.blocking_pop(str(self.stomp_connector.correlation_id))
+
+  def register(self):
+    # TODO STOMP: prepare data to register
+    data = {'registration-test':'true'}
+    self.server_responses_listener = ServerResponsesListener()
+    self.stomp_connector._connection = self.stomp_connector._create_new_connection(self.server_responses_listener)
+    self.stomp_connector.add_listener(self.server_responses_listener)
+    self.stomp_connector.subscribe(destination=SERVER_RESPONSES_ENDPOINT, id=1, ack='client-individual')
+
+    logger.debug("Registration request is {0}".format(data))
+    response = self.blocking_request(data, REGISTRATION_ENDPOINT)
+    logger.debug("Registration response is {0}".format(response))
+
+    # TODO STOMP: handle registration response
+    self.registered = True
+
+  def get_heartbeat_body(self):
+    return {'heartbeat-request-test':'true'}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/2f20b2ed/ambari-agent/src/main/python/ambari_agent/Utils.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/Utils.py b/ambari-agent/src/main/python/ambari_agent/Utils.py
index e7b03f9..8078ad2 100644
--- a/ambari-agent/src/main/python/ambari_agent/Utils.py
+++ b/ambari-agent/src/main/python/ambari_agent/Utils.py
@@ -17,6 +17,43 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 """
+import threading
+
+class BlockingDictionary():
+  """
+  A dictionary like class.
+  Which allow putting an item. And retrieving it in blocking way (the caller is blocked until item is available).
+  """
+  def __init__(self, dictionary=None):
+    self.dict = {} if dictionary is None else dictionary
+    self.cv = threading.Condition()
+    self.put_event = threading.Event()
+    self.dict_lock = threading.RLock()
+
+  def put(self, key, value):
+    """
+    Thread-safe put to dictionary.
+    """
+    with self.dict_lock:
+      self.dict[key] = value
+    self.put_event.set()
+
+  def blocking_pop(self, key):
+    """
+    Block until a key in dictionary is available and than pop it.
+    """
+    while True:
+      self.put_event.wait()
+      self.put_event.clear()
+      with self.dict_lock:
+        if key in self.dict:
+          return self.dict.pop(key)
+
+  def __repr__(self):
+    return self.dict.__repr__()
+
+  def __str__(self):
+    return self.dict.__str__()
 
 class Utils(object):
   @staticmethod

http://git-wip-us.apache.org/repos/asf/ambari/blob/2f20b2ed/ambari-agent/src/main/python/ambari_agent/listeners/ServerResponsesListener.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/listeners/ServerResponsesListener.py b/ambari-agent/src/main/python/ambari_agent/listeners/ServerResponsesListener.py
new file mode 100644
index 0000000..c7ad082
--- /dev/null
+++ b/ambari-agent/src/main/python/ambari_agent/listeners/ServerResponsesListener.py
@@ -0,0 +1,39 @@
+#!/usr/bin/env python
+
+'''
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+'''
+
+import logging
+import ambari_stomp
+
+from ambari_agent import Utils
+from ambari_agent.Constants import CORRELATION_ID_STRING
+
+logging = logging.getLogger(__name__)
+
+class ServerResponsesListener(ambari_stomp.ConnectionListener):
+  def __init__(self):
+    self.responses = Utils.BlockingDictionary()
+
+  def on_message(self, headers, message):
+    logging.debug("Received headers={0} ; message={1}".format(headers, message))
+
+    if CORRELATION_ID_STRING in headers:
+      self.responses.put(headers[CORRELATION_ID_STRING], message)
+    else:
+      logging.warn("Received a message from server without a '{0}' header. Ignoring the message".format(CORRELATION_ID_STRING))
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/2f20b2ed/ambari-agent/src/main/python/ambari_agent/listeners/TopologyEventListener.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/listeners/TopologyEventListener.py b/ambari-agent/src/main/python/ambari_agent/listeners/TopologyEventListener.py
new file mode 100644
index 0000000..44afc48
--- /dev/null
+++ b/ambari-agent/src/main/python/ambari_agent/listeners/TopologyEventListener.py
@@ -0,0 +1,25 @@
+#!/usr/bin/env python
+
+'''
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+'''
+
+import ambari_stomp
+
+class MyListener(ambari_stomp.ConnectionListener):
+  def on_message(self, headers, message):
+    print "Received {0}".format(message)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/2f20b2ed/ambari-agent/src/main/python/ambari_agent/listeners/__init__.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/listeners/__init__.py b/ambari-agent/src/main/python/ambari_agent/listeners/__init__.py
new file mode 100644
index 0000000..8cfcc3f
--- /dev/null
+++ b/ambari-agent/src/main/python/ambari_agent/listeners/__init__.py
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+"""
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/2f20b2ed/ambari-agent/src/main/python/ambari_agent/security.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/security.py b/ambari-agent/src/main/python/ambari_agent/security.py
index 45de7bb..32ad556 100644
--- a/ambari-agent/src/main/python/ambari_agent/security.py
+++ b/ambari-agent/src/main/python/ambari_agent/security.py
@@ -29,6 +29,7 @@ import pprint
 import traceback
 import hostname
 import platform
+import ambari_stomp
 
 logger = logging.getLogger(__name__)
 
@@ -99,6 +100,41 @@ class VerifiedHTTPSConnection(httplib.HTTPSConnection):
 
     return sock
 
+# TODO STOMP: When server part is ready re-write this class by extending WsConnection.
+class StompConnector:
+  def __init__(self):
+    self.correlation_id = -1
+    self._connection = None
+
+  # TODO STOMP: re-init this on_disconnect
+  def _get_connection(self):
+    if not self._connection:
+      self._connection = self._create_new_connection()
+    return self._connection
+
+  def _create_new_connection(self, listener):
+    # Connection for unit tests. TODO STOMP: fix this
+    hosts = [('127.0.0.1', 21613)]
+    connection = ambari_stomp.Connection(host_and_ports=hosts)
+    connection.set_listener('my_listener', listener)
+    connection.start()
+    connection.connect(wait=True)
+
+    return connection
+
+  def send(self, destination, body, content_type=None, headers=None, **keyword_headers):
+    self.correlation_id += 1
+    self._get_connection().send(destination, body, content_type=content_type, headers=headers, correlationId=self.correlation_id, **keyword_headers)
+
+  def subscribe(self, *args, **kwargs):
+    self._get_connection().subscribe(*args, **kwargs)
+
+  def untrack_connection(self):
+    self.conn = None
+
+  def add_listener(self, listener):
+    pass
+    #self._get_connection().set_listener('my_listener', listener)
 
 class CachedHTTPSConnection:
   """ Caches a ssl socket and uses a single https connection to the server. """
@@ -254,7 +290,7 @@ class CertificateManager():
     generate_script = GEN_AGENT_KEY % {
       'hostname': hostname.hostname(self.config),
       'keysdir': keysdir}
-    
+
     logger.info(generate_script)
     if platform.system() == 'Windows':
       p = subprocess.Popen(generate_script, stdout=subprocess.PIPE)

http://git-wip-us.apache.org/repos/asf/ambari/blob/2f20b2ed/ambari-agent/src/test/python/ambari_agent/TestAgentStompResponses.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/ambari_agent/TestAgentStompResponses.py b/ambari-agent/src/test/python/ambari_agent/TestAgentStompResponses.py
index 983b392..b0f3a16 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestAgentStompResponses.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestAgentStompResponses.py
@@ -17,15 +17,77 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 '''
+import os
+import sys
+import logging
 import json
+import time
 from coilmq.util import frames
 from coilmq.util.frames import Frame
 
 from BaseStompServerTestCase import BaseStompServerTestCase
 
+from ambari_agent import HeartbeatThread
+
+from mock.mock import MagicMock, patch
+
+# TODO: where agent sends?
+
 class TestAgentStompResponses(BaseStompServerTestCase):
-  def test_mock_server_can_start(self):
-    f = Frame(frames.MESSAGE, headers={'destination': '/clusters/c1/topologies'}, body=json.loads(self.get_json("topology_update.json")))
+  @patch.object(HeartbeatThread, "time")
+  def test_mock_server_can_start(self, time_mock):
+    self.init_stdout_logger()
+
+    heartbeat_thread = HeartbeatThread.HeartbeatThread()
+    heartbeat_thread.start()
+
+    connect_frame = self.server.frames_queue.get()
+    users_subscribe_frame = self.server.frames_queue.get()
+    registration_frame = self.server.frames_queue.get()
+
+    # server sends registration response
+    f = Frame(frames.MESSAGE, headers={'destination': '/user', 'correlationId': '0'}, body=self.get_json("registration_response.json"))
+    self.server.topic_manager.send(f)
+
+    heartbeat_frame = self.server.frames_queue.get()
+
+    heartbeat_thread._stop.set()
+
+    # server sends heartbeat response
+    f = Frame(frames.MESSAGE, headers={'destination': '/user', 'correlationId': '1'}, body=json.dumps({'heartbeat-response':'true'}))
+    self.server.topic_manager.send(f)
+
+    heartbeat_thread.join()
+    print "Thread successfully finished"
+
+  def _other(self):
+    f = Frame(frames.MESSAGE, headers={'destination': '/events/configurations'}, body=self.get_json("configurations_update.json"))
+    self.server.topic_manager.send(f)
+
+    f = Frame(frames.MESSAGE, headers={'destination': '/events/commands'}, body=self.get_json("execution_commands.json"))
+    self.server.topic_manager.send(f)
+
+    f = Frame(frames.MESSAGE, headers={'destination': '/events/metadata'}, body=self.get_json("metadata_update.json"))
     self.server.topic_manager.send(f)
-    
-    
\ No newline at end of file
+
+    f = Frame(frames.MESSAGE, headers={'destination': '/events/topologies'}, body=self.get_json("topology_update.json"))
+    self.server.topic_manager.send(f)
+
+  def init_stdout_logger(self):
+    format='%(levelname)s %(asctime)s - %(message)s'
+
+    logger = logging.getLogger()
+    logger.setLevel(logging.DEBUG)
+    formatter = logging.Formatter(format)
+    chout = logging.StreamHandler(sys.stdout)
+    chout.setLevel(logging.DEBUG)
+    chout.setFormatter(formatter)
+    cherr = logging.StreamHandler(sys.stderr)
+    cherr.setLevel(logging.ERROR)
+    cherr.setFormatter(formatter)
+    logger.handlers = []
+    logger.addHandler(cherr)
+    logger.addHandler(chout)
+
+    logging.getLogger('stomp.py').setLevel(logging.WARN)
+    logging.getLogger('coilmq').setLevel(logging.INFO)
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/2f20b2ed/ambari-agent/src/test/python/ambari_agent/dummy_files/stomp/heartbeat_request.json
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/ambari_agent/dummy_files/stomp/heartbeat_request.json b/ambari-agent/src/test/python/ambari_agent/dummy_files/stomp/heartbeat_request.json
new file mode 100644
index 0000000..155e796
--- /dev/null
+++ b/ambari-agent/src/test/python/ambari_agent/dummy_files/stomp/heartbeat_request.json
@@ -0,0 +1,3 @@
+{
+  "alerts": []
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/2f20b2ed/ambari-common/src/test/python/coilmq/server/socket_server.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/test/python/coilmq/server/socket_server.py b/ambari-common/src/test/python/coilmq/server/socket_server.py
index b4f081e..872ec01 100644
--- a/ambari-common/src/test/python/coilmq/server/socket_server.py
+++ b/ambari-common/src/test/python/coilmq/server/socket_server.py
@@ -4,6 +4,7 @@ The default/recommended SocketServer-based server implementation.
 import logging
 import socket
 import threading
+import Queue
 try:
     from socketserver import BaseRequestHandler, TCPServer, ThreadingMixIn
 except ImportError:
@@ -79,6 +80,7 @@ class StompRequestHandler(BaseRequestHandler, StompConnection):
                     self.buffer.append(data)
 
                     for frame in self.buffer:
+                        self.server.frames_queue.put(frame)
                         self.log.debug("Processing frame: %s" % frame)
                         self.engine.process_frame(frame)
                         if not self.engine.connected:
@@ -154,6 +156,7 @@ class StompServer(TCPServer):
         self.queue_manager = queue_manager
         self.topic_manager = topic_manager
         self.protocol = protocol
+        self.frames_queue = Queue.Queue()
         self._serving_event = threading.Event()
         self._shutdown_request_event = threading.Event()
         TCPServer.__init__(self, server_address, RequestHandlerClass)


[06/22] ambari git commit: AMBARI-20670 Node manager start extremely slow when YARN NM local dirs are very large (dgrinenko via dsen)

Posted by ao...@apache.org.
AMBARI-20670 Node manager start extremely slow when YARN NM local dirs are very large (dgrinenko via dsen)


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

Branch: refs/heads/branch-3.0-perf
Commit: ecc3fdf68bd436d562a622255597229d2f7b4134
Parents: b2bcc38
Author: Dmytro Sen <ds...@apache.org>
Authored: Thu Apr 6 15:22:10 2017 +0300
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Tue Apr 11 14:14:12 2017 +0300

----------------------------------------------------------------------
 .../python/resource_management/TestUtils.py     | 39 +++++++++++++
 .../python/resource_management/core/sudo.py     | 58 +++++++++++++++-----
 .../python/resource_management/core/utils.py    | 56 ++++++++++++++++++-
 .../YARN/2.1.0.2.0/package/scripts/yarn.py      | 16 ++++--
 .../YARN/3.0.0.3.0/package/scripts/yarn.py      | 14 +++--
 5 files changed, 159 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ecc3fdf6/ambari-agent/src/test/python/resource_management/TestUtils.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/resource_management/TestUtils.py b/ambari-agent/src/test/python/resource_management/TestUtils.py
new file mode 100644
index 0000000..0fbae3e
--- /dev/null
+++ b/ambari-agent/src/test/python/resource_management/TestUtils.py
@@ -0,0 +1,39 @@
+"""
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+"""
+
+import stat
+from unittest import TestCase
+from resource_management.core.utils import attr_to_bitmask
+
+
+class TestUtils(TestCase):
+
+  def test_attr_to_bitmask(self):
+    test_set = [
+      ["+r", stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH, 0],
+      ["u+w", stat.S_IWUSR, 0],
+      ["uo+x", stat.S_IXUSR | stat.S_IXOTH, 0],
+      ["-x", stat.S_IRUSR, stat.S_IXUSR | stat.S_IXOTH | stat.S_IRUSR],
+      ["=x", stat.S_IXUSR | stat.S_IXOTH | stat.S_IXGRP, stat.S_IRUSR | stat.S_IRGRP]
+    ]
+
+    for test in test_set:
+      test_pattern, expected, initial_val = test
+      bitmask = attr_to_bitmask(test_pattern, initial_bitmask= initial_val)
+      self.assertEquals(expected, bitmask, "Test set \"{0}\" failed, expected: {1} but got {2}".format(
+        test_pattern, expected, bitmask))

http://git-wip-us.apache.org/repos/asf/ambari/blob/ecc3fdf6/ambari-common/src/main/python/resource_management/core/sudo.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/core/sudo.py b/ambari-common/src/main/python/resource_management/core/sudo.py
index d6fd71f..c350161 100644
--- a/ambari-common/src/main/python/resource_management/core/sudo.py
+++ b/ambari-common/src/main/python/resource_management/core/sudo.py
@@ -30,6 +30,7 @@ from resource_management.core import shell
 from resource_management.core.exceptions import Fail
 import subprocess
 
+from resource_management.core.utils import attr_to_bitmask
 
 if os.geteuid() == 0:
   def chown(path, owner, group):
@@ -54,16 +55,45 @@ if os.geteuid() == 0:
             
   
   def chmod(path, mode):
+    """
+    Wrapper around python function
+    
+    :type path str
+    :type mode int
+    """
     return os.chmod(path, mode)
   
-  mode_to_stat = {"a+x": stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH, "a+rx": stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH | stat.S_IRUSR | stat.S_IRGRP | stat.S_IROTH, "u+x": stat.S_IXUSR, "g+x": stat.S_IXGRP,  "o+x": stat.S_IXOTH}
+
   def chmod_extended(path, mode):
-    if mode in mode_to_stat:
-      st = os.stat(path)
-      os.chmod(path, st.st_mode | mode_to_stat[mode])
-    else:
-      shell.checked_call(["chmod", mode, path])
-      
+    """
+    :type path str
+    :type mode str
+    """
+    st = os.stat(path)
+    os.chmod(path, attr_to_bitmask(mode, initial_bitmask=st.st_mode))
+
+  def chmod_recursive(path, recursive_mode_flags, recursion_follow_links=False):
+    """
+    Change recursively permissions on directories or files
+    
+    :type path str
+    :type recursive_mode_flags
+    :type recursion_follow_links bool
+    """
+    dir_attrib = recursive_mode_flags["d"] if "d" in recursive_mode_flags else None
+    files_attrib = recursive_mode_flags["f"] if "d" in recursive_mode_flags else None
+
+    for root, dirs, files in os.walk(path, followlinks=recursion_follow_links):
+      if dir_attrib is not None:
+        for dir_name in dirs:
+          full_dir_path = os.path.join(root, dir_name)
+          chmod(full_dir_path, attr_to_bitmask(dir_attrib, initial_bitmask=os.stat(full_dir_path).st_mode))
+
+      if files_attrib is not None:
+        for file_name in files:
+          full_file_path = os.path.join(root, file_name)
+          chmod(full_file_path, attr_to_bitmask(files_attrib, initial_bitmask=os.stat(full_file_path).st_mode))
+
   def copy(src, dst):
     shutil.copy(src, dst)
     
@@ -278,10 +308,10 @@ else:
     return files
 
 
-def chmod_recursive(path, recursive_mode_flags, recursion_follow_links):
-  find_flags = []
-  if recursion_follow_links:
-    find_flags.append('-L')
-    
-  for key, flags in recursive_mode_flags.iteritems():
-    shell.checked_call(["find"] + find_flags + [path, "-type", key, "-exec" , "chmod", flags ,"{}" ,";"])
+  def chmod_recursive(path, recursive_mode_flags, recursion_follow_links):
+    find_flags = []
+    if recursion_follow_links:
+      find_flags.append('-L')
+
+    for key, flags in recursive_mode_flags.iteritems():
+      shell.checked_call(["find"] + find_flags + [path, "-type", key, "-exec" , "chmod", flags ,"{}" ,";"])

http://git-wip-us.apache.org/repos/asf/ambari/blob/ecc3fdf6/ambari-common/src/main/python/resource_management/core/utils.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/core/utils.py b/ambari-common/src/main/python/resource_management/core/utils.py
index 265b2f2..53f6b8b 100644
--- a/ambari-common/src/main/python/resource_management/core/utils.py
+++ b/ambari-common/src/main/python/resource_management/core/utils.py
@@ -27,10 +27,16 @@ import sys
 import signal
 import cStringIO
 from functools import wraps
+
+import re
+
 from resource_management.core.exceptions import Fail
 from itertools import chain, repeat, islice
 
 PASSWORDS_HIDE_STRING = "[PROTECTED]"
+PERM_STRING_REGEXP = re.compile("(?P<scope>[ugoa]*)(?P<direction>[-+=])(?P<attr>[rwx]*)")
+PERM_REGISTER = {"u": 0o100, "g": 0o010, "o": 0o001}
+PERM_BITS = {"r": 0o004, "w": 0o002, "x": 0o001}
 
 class AttributeDictionary(object):
   def __init__(self, *args, **kwargs):
@@ -157,4 +163,52 @@ def pad_infinite(iterable, padding=None):
   return chain(iterable, repeat(padding))
 
 def pad(iterable, size, padding=None):
-  return islice(pad_infinite(iterable, padding), size)
\ No newline at end of file
+  return islice(pad_infinite(iterable, padding), size)
+
+
+def attr_to_bitmask(attr, initial_bitmask=0o0):
+  """
+  Function able to generate permission bits from passed named permission string (chmod like style)
+   
+  Supports:
+   - scope modifications: u,g,o or a 
+   - setting mode: +,-,-
+   - attributes: r,x,w
+   
+  Samples:
+    uo+rw, a+x, u-w, o=r
+  
+  :type attr str 
+  :type initial_bitmask int
+  """
+  attr_dict = {"scope": "", "direction": "", "attr": ""}
+  re_match_result = PERM_STRING_REGEXP.match(attr)
+
+  if re_match_result:
+    attr_dict = re_match_result.groupdict(default=attr_dict)
+
+  if attr_dict["scope"] == "":
+    attr_dict["scope"] = "a"
+
+  if "a" in attr_dict["scope"]:
+    attr_dict["scope"] = "ugo"
+
+  attr_dict["scope"] = list(attr_dict["scope"])
+  attr_dict["attr"] = list(attr_dict["attr"])
+
+  if attr_dict["direction"] == "=":
+    clear_mask = 0o0
+    for scope in attr_dict["scope"]:
+      clear_mask = clear_mask | 0o007 * PERM_REGISTER[scope]
+
+    initial_bitmask = initial_bitmask ^ (initial_bitmask & clear_mask)
+    attr_dict["direction"] = "+"
+
+  for scope in attr_dict["scope"]:
+    for attr in attr_dict["attr"]:
+      if attr_dict["direction"] == "-" and (initial_bitmask & (PERM_BITS[attr] * PERM_REGISTER[scope])) > 0:
+        initial_bitmask = initial_bitmask ^ (PERM_BITS[attr] * PERM_REGISTER[scope])
+      elif attr_dict["direction"] == "+":
+        initial_bitmask = initial_bitmask | (PERM_BITS[attr] * PERM_REGISTER[scope])
+
+  return initial_bitmask

http://git-wip-us.apache.org/repos/asf/ambari/blob/ecc3fdf6/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/yarn.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/yarn.py b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/yarn.py
index 204ab56..52338df 100644
--- a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/yarn.py
+++ b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/yarn.py
@@ -347,7 +347,6 @@ def setup_nodemanager():
     elif not params.security_enabled:
       File(params.nm_security_marker, action="delete")
 
-
   if not params.security_enabled or params.toggle_nm_security:
     # handle_mounted_dirs ensures that we don't create dirs which are temporary unavailable (unmounted), and intended to reside on a different mount.
     nm_log_dir_to_mount_file_content = handle_mounted_dirs(create_log_dir, params.nm_log_dirs, params.nm_log_dir_to_mount_file, params)
@@ -459,17 +458,24 @@ def create_log_dir(dir_name):
             ignore_failures=True,
   )
 
+
 def create_local_dir(dir_name):
   import params
+
+  directory_args = {}
+
+  if params.toggle_nm_security:
+    directory_args["recursive_mode_flags"] = {'f': 'a+rw', 'd': 'a+rwx'}
+
   Directory(dir_name,
-            create_parents = True,
+            create_parents=True,
             cd_access="a",
             mode=0755,
             owner=params.yarn_user,
             group=params.user_group,
             ignore_failures=True,
-            recursive_mode_flags = {'f': 'a+rw', 'd': 'a+rwx'},
-  )
+            **directory_args
+            )
 
 @OsFamilyFuncImpl(os_family=OSConst.WINSRV_FAMILY)
 def yarn(name = None):
@@ -500,4 +506,4 @@ def yarn(name = None):
     ServiceConfig(service_name,
                   action="change_user",
                   username = params.yarn_user,
-                  password = Script.get_password(params.yarn_user))
\ No newline at end of file
+                  password = Script.get_password(params.yarn_user))

http://git-wip-us.apache.org/repos/asf/ambari/blob/ecc3fdf6/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/yarn.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/yarn.py b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/yarn.py
index ae1b425..d601f8f 100644
--- a/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/yarn.py
+++ b/ambari-server/src/main/resources/common-services/YARN/3.0.0.3.0/package/scripts/yarn.py
@@ -347,7 +347,6 @@ def setup_nodemanager():
     elif not params.security_enabled:
       File(params.nm_security_marker, action="delete")
 
-
   if not params.security_enabled or params.toggle_nm_security:
     # handle_mounted_dirs ensures that we don't create dirs which are temporary unavailable (unmounted), and intended to reside on a different mount.
     nm_log_dir_to_mount_file_content = handle_mounted_dirs(create_log_dir, params.nm_log_dirs, params.nm_log_dir_to_mount_file, params)
@@ -459,16 +458,23 @@ def create_log_dir(dir_name):
             ignore_failures=True,
   )
 
+
 def create_local_dir(dir_name):
   import params
+
+  directory_args = {}
+
+  if params.toggle_nm_security:
+    directory_args["recursive_mode_flags"] = {'f': 'a+rw', 'd': 'a+rwx'}
+
   Directory(dir_name,
-            create_parents = True,
+            create_parents=True,
             cd_access="a",
             mode=0755,
             owner=params.yarn_user,
             group=params.user_group,
             ignore_failures=True,
-            recursive_mode_flags = {'f': 'a+rw', 'd': 'a+rwx'},
+            **directory_args
   )
 
 @OsFamilyFuncImpl(os_family=OSConst.WINSRV_FAMILY)
@@ -500,4 +506,4 @@ def yarn(name = None):
     ServiceConfig(service_name,
                   action="change_user",
                   username = params.yarn_user,
-                  password = Script.get_password(params.yarn_user))
\ No newline at end of file
+                  password = Script.get_password(params.yarn_user))


[13/22] ambari git commit: AMBARI-20711 Post-install host check: 'Rerun Checks' button is never disabled. (ababiichuk)

Posted by ao...@apache.org.
AMBARI-20711 Post-install host check: 'Rerun Checks' button is never disabled. (ababiichuk)


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

Branch: refs/heads/branch-3.0-perf
Commit: 827cc03b5c8c85d6e33491ce73e0bbfda2d4b436
Parents: 9ca337c
Author: ababiichuk <ab...@hortonworks.com>
Authored: Fri Apr 7 19:15:34 2017 +0300
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Tue Apr 11 14:14:12 2017 +0300

----------------------------------------------------------------------
 ambari-web/app/controllers/main/host/details.js | 14 ++++++++----
 .../app/controllers/wizard/step3_controller.js  | 10 +++-----
 .../main/host/details/actions/check_host.js     | 24 +++++++++++++++++---
 .../wizard/step3/hostWarningPopupFooter_view.js |  4 ++--
 .../step3/hostWarningPopupFooter_view_test.js   | 14 ++++++++----
 5 files changed, 46 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/827cc03b/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 6e85190..def75d6 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -2426,8 +2426,11 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
   runHostCheck: function () {
     var dataForCheckHostRequest = this.getDataForHostCheck();
 
-    this.set('stopChecking', false);
-    this.set('checkHostFinished', false);
+    this.setProperties({
+      stopChecking: false,
+      checkHostFinished: false,
+      isRerun: false
+    });
     this.setBootHostsProp();
     this.showHostWarningsPopup();
     this.requestToPerformHostCheck(dataForCheckHostRequest);
@@ -2486,14 +2489,17 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
       },
 
       footerClass: App.WizardStep3HostWarningPopupFooter.reopen({
-        footerControllerBinding: 'App.router.mainHostDetailsController'
+        footerControllerBinding: 'App.router.mainHostDetailsController',
+        checkHostFinished: function () {
+          return this.get('footerController.checkHostFinished');
+        }.property('footerController.checkHostFinished')
       }),
 
       bodyClass: App.WizardStep3HostWarningPopupBody.reopen({
         bodyControllerBinding: 'App.router.mainHostDetailsController',
         checkHostFinished: function () {
           return this.get('bodyController.checkHostFinished');
-        }.property('bodyController.checkHostFinished'),
+        }.property('bodyController.checkHostFinished')
       })
     });
   },

http://git-wip-us.apache.org/repos/asf/ambari/blob/827cc03b/ambari-web/app/controllers/wizard/step3_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step3_controller.js b/ambari-web/app/controllers/wizard/step3_controller.js
index c282451..29393e3 100644
--- a/ambari-web/app/controllers/wizard/step3_controller.js
+++ b/ambari-web/app/controllers/wizard/step3_controller.js
@@ -121,12 +121,6 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin, App.Check
   }.property('content.hosts'),
 
   /**
-   * Timeout for "warning"-requests
-   * @type {number}
-   */
-  warningsTimeInterval: 60000,
-
-  /**
    * Are hosts warnings loaded
    * @type {bool}
    */
@@ -909,7 +903,9 @@ App.WizardStep3Controller = Em.Controller.extend(App.ReloadPopupMixin, App.Check
         this.fitHeight();
       },
 
-      footerClass: App.WizardStep3HostWarningPopupFooter,
+      footerClass: App.WizardStep3HostWarningPopupFooter.reopen({
+        checkHostFinished: true
+      }),
 
       bodyClass: App.WizardStep3HostWarningPopupBody.reopen({
         checkHostFinished: true

http://git-wip-us.apache.org/repos/asf/ambari/blob/827cc03b/ambari-web/app/mixins/main/host/details/actions/check_host.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/main/host/details/actions/check_host.js b/ambari-web/app/mixins/main/host/details/actions/check_host.js
index c0ebf02..80f4f03 100644
--- a/ambari-web/app/mixins/main/host/details/actions/check_host.js
+++ b/ambari-web/app/mixins/main/host/details/actions/check_host.js
@@ -99,6 +99,17 @@ App.CheckHostMixin = Em.Mixin.create({
    */
   isAddHostWizard: false,
 
+  /**
+   * True if user triggered host checks rerun
+   * @type {boolean}
+   */
+  isRerun: false,
+
+  /**
+   * Timeout for "warning"-requests
+   * @type {number}
+   */
+  warningsTimeInterval: 60000,
 
   /**
    * disables host check on Add host wizard as per the experimental flag
@@ -334,7 +345,7 @@ App.CheckHostMixin = Em.Mixin.create({
     this.set('diskCategoryWarnings', diskWarnings);
     this.set('thpCategoryWarnings', thpWarnings);
     this.stopRegistration();
-    this.get('name') === 'mainHostDetailsController' && this.set('checkHostFinished', true);
+    this.get('name') === 'mainHostDetailsController' && !this.get('isRerun') && this.set('checkHostFinished', true);
   },
 
   /**
@@ -415,7 +426,10 @@ App.CheckHostMixin = Em.Mixin.create({
     var self = this;
     var currentProgress = 0;
     this.get('name') === 'wizardStep3Controller' ? this.getHostNameResolution() : this.getHostNameResolution(this.getDataForHostCheck());
-    this.set('stopChecking', false);
+    this.setProperties({
+      stopChecking: false,
+      isRerun: true
+    });
     this.get('name') === 'wizardStep3Controller' ? this.getGeneralHostCheck() : this.getGeneralHostCheck(this.getDataForHostCheck());
     this.get('name') === 'wizardStep3Controller' && this.checkHostJDK();
     var interval = setInterval(function () {
@@ -428,7 +442,11 @@ App.CheckHostMixin = Em.Mixin.create({
           name: 'wizard.step3.rerun_checks',
           sender: self,
           success: 'rerunChecksSuccessCallback',
-          error: 'rerunChecksErrorCallback'
+          error: 'rerunChecksErrorCallback',
+          callback: function () {
+            self.set('isRerun', false);
+            self.get('name') === 'mainHostDetailsController' && self.set('checkHostFinished', true);
+          }
         });
       }
     }, 1000);

http://git-wip-us.apache.org/repos/asf/ambari/blob/827cc03b/ambari-web/app/views/wizard/step3/hostWarningPopupFooter_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/wizard/step3/hostWarningPopupFooter_view.js b/ambari-web/app/views/wizard/step3/hostWarningPopupFooter_view.js
index fb2019c..9461074 100644
--- a/ambari-web/app/views/wizard/step3/hostWarningPopupFooter_view.js
+++ b/ambari-web/app/views/wizard/step3/hostWarningPopupFooter_view.js
@@ -29,9 +29,9 @@ App.WizardStep3HostWarningPopupFooter = Em.View.extend({
   progressWidth: Em.computed.format('width:{0}%', 'footerController.checksUpdateProgress'),
 
   isUpdateInProgress: function () {
-    return (this.get('footerController.checksUpdateProgress') > 0) &&
+    return !this.get('checkHostFinished') || (this.get('footerController.checksUpdateProgress') > 0) &&
       (this.get('footerController.checksUpdateProgress') < 100);
-  }.property('footerController.checksUpdateProgress'),
+  }.property('checkHostFinished', 'footerController.checksUpdateProgress'),
 
   updateStatusClass: function () {
     var status = this.get('footerController.checksUpdateStatus');

http://git-wip-us.apache.org/repos/asf/ambari/blob/827cc03b/ambari-web/test/views/wizard/step3/hostWarningPopupFooter_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/wizard/step3/hostWarningPopupFooter_view_test.js b/ambari-web/test/views/wizard/step3/hostWarningPopupFooter_view_test.js
index d1fbc24..a366fe7 100644
--- a/ambari-web/test/views/wizard/step3/hostWarningPopupFooter_view_test.js
+++ b/ambari-web/test/views/wizard/step3/hostWarningPopupFooter_view_test.js
@@ -36,13 +36,19 @@ describe('App.WizardStep3HostWarningPopupFooter', function() {
 
   describe('#isUpdateInProgress', function() {
     var tests = Em.A([
-      {checksUpdateProgress: 0, e: false},
-      {checksUpdateProgress: 100, e: false},
-      {checksUpdateProgress: 50, e: true}
+      {checksUpdateProgress: 0, checkHostFinished: true, e: false},
+      {checksUpdateProgress: 100, checkHostFinished: true, e: false},
+      {checksUpdateProgress: 50, checkHostFinished: true, e: true},
+      {checksUpdateProgress: 0, checkHostFinished: false, e: true},
+      {checksUpdateProgress: 100, checkHostFinished: false, e: true},
+      {checksUpdateProgress: 50, checkHostFinished: false, e: true}
     ]);
     tests.forEach(function(test) {
       it(test.checksUpdateProgress, function() {
-        view.set('footerController.checksUpdateProgress', test.checksUpdateProgress);
+        view.setProperties({
+          'checkHostFinished': test.checkHostFinished,
+          'footerController.checksUpdateProgress': test.checksUpdateProgress
+        });
         expect(view.get('isUpdateInProgress')).to.equal(test.e);
       });
     });


[05/22] ambari git commit: AMBARI-20591 In case of HA-enabled cluster on shutting down Active Master, Ambari rest api call and HBase quick links show two Active Masters (dsen)

Posted by ao...@apache.org.
AMBARI-20591 In case of HA-enabled cluster on shutting down Active Master, Ambari rest api call and HBase quick links show two Active Masters (dsen)


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

Branch: refs/heads/branch-3.0-perf
Commit: b2bcc38ed917f3b43fa21133f64cdb4642e3c2e1
Parents: 8de3961
Author: Dmytro Sen <ds...@apache.org>
Authored: Thu Apr 6 15:13:52 2017 +0300
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Tue Apr 11 14:14:12 2017 +0300

----------------------------------------------------------------------
 .../state/services/MetricsRetrievalService.java | 29 ++++++++-
 .../services/MetricsRetrievalServiceTest.java   | 63 ++++++++++++++++++++
 2 files changed, 91 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/b2bcc38e/ambari-server/src/main/java/org/apache/ambari/server/state/services/MetricsRetrievalService.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/state/services/MetricsRetrievalService.java b/ambari-server/src/main/java/org/apache/ambari/server/state/services/MetricsRetrievalService.java
index 79e0e25..59ec15b 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/state/services/MetricsRetrievalService.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/state/services/MetricsRetrievalService.java
@@ -18,6 +18,7 @@
 package org.apache.ambari.server.state.services;
 
 import java.io.BufferedReader;
+import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.lang.Thread.UncaughtExceptionHandler;
@@ -441,7 +442,12 @@ public class MetricsRetrievalService extends AbstractService {
         if (null != m_ttlUrlCache) {
           m_ttlUrlCache.put(m_url, m_url);
         }
-
+      } catch (IOException exception)
+      {
+        LOG.debug("Removing cached values for url {}", m_url);
+        // need to ensure old values are removed because they could be not valid if the state have changed.
+        removeCachedMetricsForCurrentURL();
+        logException(exception, m_url);
       } catch (Exception exception) {
         logException(exception, m_url);
       } finally {
@@ -454,6 +460,11 @@ public class MetricsRetrievalService extends AbstractService {
     }
 
     /**
+     * Removes metric values for current URL from cache.
+     */
+    protected abstract void removeCachedMetricsForCurrentURL();
+
+    /**
      * Reads data from the specified {@link InputStream} and processes that into
      * a cachable value. The value will then be cached by this method.
      *
@@ -536,6 +547,14 @@ public class MetricsRetrievalService extends AbstractService {
      * {@inheritDoc}
      */
     @Override
+    protected void removeCachedMetricsForCurrentURL() {
+      m_cache.invalidate(m_url);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
     protected void processInputStreamAndCacheResult(InputStream inputStream) throws Exception {
       JMXMetricHolder jmxMetricHolder = m_jmxObjectReader.readValue(inputStream);
       m_cache.put(m_url, jmxMetricHolder);
@@ -575,6 +594,14 @@ public class MetricsRetrievalService extends AbstractService {
      * {@inheritDoc}
      */
     @Override
+    protected void removeCachedMetricsForCurrentURL() {
+      m_cache.invalidate(m_url);
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
     protected void processInputStreamAndCacheResult(InputStream inputStream) throws Exception {
       Type type = new TypeToken<Map<Object, Object>>() {}.getType();
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/b2bcc38e/ambari-server/src/test/java/org/apache/ambari/server/state/services/MetricsRetrievalServiceTest.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/java/org/apache/ambari/server/state/services/MetricsRetrievalServiceTest.java b/ambari-server/src/test/java/org/apache/ambari/server/state/services/MetricsRetrievalServiceTest.java
index 784ba92..ea204aa 100644
--- a/ambari-server/src/test/java/org/apache/ambari/server/state/services/MetricsRetrievalServiceTest.java
+++ b/ambari-server/src/test/java/org/apache/ambari/server/state/services/MetricsRetrievalServiceTest.java
@@ -17,6 +17,7 @@
  */
 package org.apache.ambari.server.state.services;
 
+import java.io.IOException;
 import java.io.InputStream;
 import java.util.Map;
 
@@ -117,6 +118,68 @@ public class MetricsRetrievalServiceTest extends EasyMockSupport {
   }
 
   /**
+   * Test removing cached values if request failed with IOException.
+   */
+  @Test
+  public void testRemovingValuesFromCacheOnFail() throws Exception {
+
+    Configuration configuration = m_injector.getInstance(Configuration.class);
+    configuration.setProperty(
+            Configuration.METRIC_RETRIEVAL_SERVICE_REQUEST_TTL.getKey(), "1");
+
+    InputStream jmxInputStream = IOUtils.toInputStream("{ \"beans\": [] }");
+    InputStream restInputStream = IOUtils.toInputStream("{}");
+
+    StreamProvider streamProvider = createNiceMock(StreamProvider.class);
+
+    EasyMock.expect(streamProvider.readFrom(JMX_URL)).andReturn(jmxInputStream).once();
+    EasyMock.expect(streamProvider.readFrom(REST_URL)).andReturn(restInputStream).once();
+
+    EasyMock.expect(streamProvider.readFrom(JMX_URL)).andThrow(new IOException()).once();
+    EasyMock.expect(streamProvider.readFrom(REST_URL)).andThrow(new IOException()).once();
+
+    replayAll();
+
+    m_service.doStart();
+
+    // make the service synchronous
+    m_service.setThreadPoolExecutor(new SynchronousThreadPoolExecutor());
+
+    JMXMetricHolder jmxMetricHolder = m_service.getCachedJMXMetric(JMX_URL);
+    Assert.assertNull(jmxMetricHolder);
+
+    Map<String, String> restMetrics = m_service.getCachedRESTMetric(REST_URL);
+    Assert.assertNull(restMetrics);
+
+    m_service.submitRequest(MetricSourceType.JMX, streamProvider, JMX_URL);
+    jmxMetricHolder = m_service.getCachedJMXMetric(JMX_URL);
+    Assert.assertNotNull(jmxMetricHolder);
+
+    m_service.submitRequest(MetricSourceType.REST, streamProvider, REST_URL);
+    restMetrics = m_service.getCachedRESTMetric(REST_URL);
+    Assert.assertNotNull(restMetrics);
+
+
+    jmxMetricHolder = m_service.getCachedJMXMetric(JMX_URL);
+    Assert.assertNotNull(jmxMetricHolder);
+
+    restMetrics = m_service.getCachedRESTMetric(REST_URL);
+    Assert.assertNotNull(restMetrics);
+
+    Thread.sleep(1000);
+
+    m_service.submitRequest(MetricSourceType.JMX, streamProvider, JMX_URL);
+    jmxMetricHolder = m_service.getCachedJMXMetric(JMX_URL);
+    Assert.assertNull(jmxMetricHolder);
+
+    m_service.submitRequest(MetricSourceType.REST, streamProvider, REST_URL);
+    restMetrics = m_service.getCachedRESTMetric(REST_URL);
+    Assert.assertNull(restMetrics);
+
+    verifyAll();
+  }
+
+  /**
    * Tests that many requests to the same URL do not invoke the stream provider
    * more than once.
    */