ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jai...@apache.org
Subject git commit: AMBARI-7041. Select Services page: service dependencies should be derived from stack API. (jaimin)
Date Wed, 27 Aug 2014 20:39:40 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk b267bd828 -> f6ee0747c


AMBARI-7041. Select Services page: service dependencies should be derived from stack API.
(jaimin)


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

Branch: refs/heads/trunk
Commit: f6ee0747c1fa2750f0eb5c6822d5023e489d8b91
Parents: b267bd8
Author: Jaimin Jetly <jaimin@hortonworks.com>
Authored: Wed Aug 27 13:37:18 2014 -0700
Committer: Jaimin Jetly <jaimin@hortonworks.com>
Committed: Wed Aug 27 13:37:18 2014 -0700

----------------------------------------------------------------------
 .../app/controllers/wizard/step4_controller.js  | 35 +++++++-----
 ambari-web/app/mappers/stack_service_mapper.js  |  1 +
 ambari-web/app/models/stack_service.js          | 44 +--------------
 .../test/controllers/wizard/step4_test.js       | 38 ++++++++++++-
 ambari-web/test/service_components.js           | 58 +++++++++++++++++++-
 5 files changed, 115 insertions(+), 61 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f6ee0747/ambari-web/app/controllers/wizard/step4_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step4_controller.js b/ambari-web/app/controllers/wizard/step4_controller.js
index 22774d2..92dbed4 100644
--- a/ambari-web/app/controllers/wizard/step4_controller.js
+++ b/ambari-web/app/controllers/wizard/step4_controller.js
@@ -254,27 +254,34 @@ App.WizardStep4Controller = Em.ArrayController.extend({
    * @method serviceDependencyValidation
    */
   serviceDependencyValidation: function() {
-    var notSelectedServices = this.filterProperty('isSelected',false);
-    notSelectedServices.forEach(function(service){
-      var showWarningPopup;
-      var dependentServices =  service.get('dependentServices');
+    var selectedServices = this.filterProperty('isSelected',true);
+    var missingDependencies = [];
+    var missingDependenciesDisplayName = [];
+    selectedServices.forEach(function(service){
+    
+      var dependentServices =  service.get('requiredServices');
       if (!!dependentServices) {
-        showWarningPopup = false;
         dependentServices.forEach(function(_dependentService){
           var dependentService = this.findProperty('serviceName', _dependentService);
-          if (dependentService && dependentService.get('isSelected') === true) {
-            showWarningPopup = true;
+          if (dependentService && dependentService.get('isSelected') === false) {
+            if(missingDependencies.indexOf(_dependentService) == -1 ) {
+              missingDependencies.push(_dependentService);
+              missingDependenciesDisplayName.push(dependentService.get('displayNameOnSelectServicePage'));
+            }
           }
         },this);
-        if (showWarningPopup) {
-          this.addValidationError({
-            id: 'serviceCheck_' + service.get('serviceName'),
-            callback: this.needToAddServicePopup,
-            callbackParams: [{serviceName: service.get('serviceName'), selected: true}, 'serviceCheck',
service.get('displayNameOnSelectServicePage')]
-          });
-        }
       }
     },this);
+    
+    if (missingDependencies.length > 0) {
+      for(var i = 0; i < missingDependencies.length; i++) {
+        this.addValidationError({
+          id: 'serviceCheck_' + missingDependencies[i],
+          callback: this.needToAddServicePopup,
+          callbackParams: [{serviceName: missingDependencies[i], selected: true}, 'serviceCheck',
missingDependenciesDisplayName[i]]
+        });
+      }
+    }
   },
 
   /**

http://git-wip-us.apache.org/repos/asf/ambari/blob/f6ee0747/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 7609d9d..1f3d0c2 100644
--- a/ambari-web/app/mappers/stack_service_mapper.js
+++ b/ambari-web/app/mappers/stack_service_mapper.js
@@ -32,6 +32,7 @@ App.stackServiceMapper = App.QuickDataMapper.create({
     stack_version: 'stack_version',
     is_selected: 'is_selected',
     is_installed: 'is_installed',
+    required_services: 'required_services',
     service_check_supported: 'service_check_supported',
     service_components_key: 'service_components',
     service_components_type: 'array',

http://git-wip-us.apache.org/repos/asf/ambari/blob/f6ee0747/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 7c69804..a711936 100644
--- a/ambari-web/app/models/stack_service.js
+++ b/ambari-web/app/models/stack_service.js
@@ -49,6 +49,7 @@ App.StackService = DS.Model.extend({
   isInstalled: DS.attr('boolean', {defaultValue: false}),
   serviceComponents: DS.hasMany('App.StackServiceComponent'),
   configs: DS.attr('array'),
+  requiredServices: DS.attr('array'),
 
   // Is the service a distributed filesystem
   isDFS: function () {
@@ -90,34 +91,6 @@ App.StackService = DS.Model.extend({
     return hiddenServices.contains(this.get('serviceName'));
   }.property('serviceName'),
 
-  dependentServices: function () {
-    var serviceName = this.get('serviceName');
-    var dependentServices = [];
-    if (App.get('isHadoop2Stack')) {
-      dependentServices = App.StackService.dependency['HDP-2'][serviceName];
-    } else {
-      dependentServices = App.StackService.dependency['HDP-1'][serviceName];
-    }
-    return dependentServices;
-  }.property('serviceName'),
-
-  /**
-   * other services on which the service is dependent
-   */
-  serviceDependency: function () {
-    var serviceName = this.get('serviceName');
-    var serviceDependencyMap, key, serviceDependencies = [];
-    if (App.get('isHadoop2Stack')) {
-      serviceDependencyMap = App.StackService.dependency['HDP-2'];
-    } else {
-      serviceDependencyMap = App.StackService.dependency['HDP-1'];
-    }
-    for (key in serviceDependencyMap) {
-      if (serviceDependencyMap[key].contains(serviceName)) serviceDependencies.push(key);
-    }
-    return  serviceDependencies;
-  }.property('serviceName'),
-
   // Is the service required for monitoring of other hadoop ecosystem services
   isMonitoringService: function () {
     var services = ['NAGIOS', 'GANGLIA'];
@@ -223,21 +196,6 @@ App.StackService.displayOrder = [
   'FLUME'
 ];
 
-App.StackService.dependency = {
-  'HDP-1': {
-    'HDFS': ['MAPREDUCE', 'HBASE', 'SQOOP'],
-    'MAPREDUCE': ['PIG', 'OOZIE', 'HIVE'],
-    'ZOOKEEPER': ['HBASE', 'HIVE', 'WEBHCAT']
-  },
-  'HDP-2': {
-    'ZOOKEEPER': ['HDFS', 'HBASE', 'HIVE', 'WEBHCAT', 'STORM'],
-    'HDFS': ['YARN', 'HBASE', 'FLUME', 'SQOOP'],
-    'YARN': ['PIG', 'OOZIE', 'HIVE', 'TEZ'],
-    'TEZ': ['YARN'],
-    'OOZIE': ['FALCON']
-  }
-};
-
 //@TODO: Write unit test for no two keys in the object should have any intersecting elements
in their values
 App.StackService.coSelected = {
   'YARN': ['MAPREDUCE2'],

http://git-wip-us.apache.org/repos/asf/ambari/blob/f6ee0747/ambari-web/test/controllers/wizard/step4_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step4_test.js b/ambari-web/test/controllers/wizard/step4_test.js
index ca693e4..7344853 100644
--- a/ambari-web/test/controllers/wizard/step4_test.js
+++ b/ambari-web/test/controllers/wizard/step4_test.js
@@ -32,6 +32,7 @@ describe('App.WizardStep4Controller', function () {
 
   var generateSelectedServicesContent = function(selectedServiceNames) {
     var allServices = services.slice(0);
+    modelSetup.setupStackServiceComponent();
     if (selectedServiceNames.contains('GLUSTERFS')) allServices.push('GLUSTERFS');
     allServices = allServices.map(function(serviceName) {
       return [Ember.Object.create({
@@ -42,7 +43,7 @@ describe('App.WizardStep4Controller', function () {
         isPrimaryDFS: serviceName == 'HDFS',
         isDFS: ['HDFS','GLUSTERFS'].contains(serviceName),
         isMonitoringService: ['NAGIOS','GANGLIA'].contains(serviceName),
-        dependentServices: App.StackService.dependency['HDP-2'][serviceName],
+        requiredServices: App.StackService.find(serviceName).get('requiredServices'),
         displayNameOnSelectServicePage: App.format.role(serviceName),
         coSelectedServices: function() {
           return App.StackService.coSelected[this.get('serviceName')] || [];
@@ -471,4 +472,39 @@ describe('App.WizardStep4Controller', function () {
     })
   });
 
+  describe('#dependencies', function() {
+    var tests = [
+      {
+        services: ['HDFS'],
+        dependencies: ['ZOOKEEPER'] 
+      },
+      {
+        services: ['STORM'],
+        dependencies: ['ZOOKEEPER'] 
+      }
+    ];
+    tests.forEach(function(test) {
+      var message = '{0} dependency should be {1}'.format(test.services.join(','), test.dependencies.join(','));
+      it(message, function() {
+        
+        controller.clear();
+        controller.set('content', generateSelectedServicesContent(test.services));
+        
+        var dependentServicesTest = [];
+        
+        test.services.forEach(function(serviceName) {
+          var service = controller.filterProperty('serviceName', serviceName);
+          service.forEach(function(item) {
+            var dependencies = item.get('requiredServices');
+            if(!!dependencies) {
+              dependentServicesTest = dependentServicesTest.concat(dependencies);
+            }
+          });
+        });
+
+        expect(dependentServicesTest).to.be.eql(test.dependencies);
+      });
+    })
+  });
+
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/f6ee0747/ambari-web/test/service_components.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/service_components.js b/ambari-web/test/service_components.js
index 8b89ab3..091048c 100644
--- a/ambari-web/test/service_components.js
+++ b/ambari-web/test/service_components.js
@@ -25,7 +25,10 @@ module.exports = {
         "display_name" : "MapReduce",
         "service_version" : "1.2.0.1.3.3.0",
         "stack_name" : "HDP",
-        "stack_version" : "1.3.2"
+        "stack_version" : "1.3.2",
+        "required_services" : [
+          "YARN"
+        ]
       },
       "serviceComponents" : [
         {
@@ -115,7 +118,10 @@ module.exports = {
               "final" : "true"
             }
           }
-        }
+        },
+        "required_services" : [
+          "OOZIE"
+        ]
       },
       "serviceComponents" : [
         {
@@ -201,7 +207,10 @@ module.exports = {
               "final" : "false"
             }
           }
-        }
+        },
+        "required_services" : [
+          "HDFS"
+        ]
       },
       "serviceComponents" : [
         {
@@ -234,6 +243,7 @@ module.exports = {
         "stack_name" : "HDP",
         "stack_version" : "2.1",
         "user_name" : null,
+        "required_services" : null,
         "config_types" : {
           "ganglia-env" : {
             "supports" : {
@@ -292,6 +302,10 @@ module.exports = {
         "stack_name" : "HDP",
         "stack_version" : "2.1",
         "user_name" : null,
+        "required_services" : [
+          "ZOOKEEPER",
+          "HDFS"
+        ],
         "config_types" : {
           "hbase-env" : {
             "supports" : {
@@ -401,6 +415,9 @@ module.exports = {
         "stack_name" : "HDP",
         "stack_version" : "2.1",
         "user_name" : null,
+        "required_services" : [
+          "HIVE"
+        ],
         "config_types" : {
           "hive-env" : {
             "supports" : {
@@ -445,6 +462,9 @@ module.exports = {
         "stack_name" : "HDP",
         "stack_version" : "2.1",
         "user_name" : null,
+        "required_services" : [
+          "ZOOKEEPER"
+        ],
         "config_types" : {
           "core-site" : {
             "supports" : {
@@ -586,6 +606,10 @@ module.exports = {
         "stack_name" : "HDP",
         "stack_version" : "2.1",
         "user_name" : null,
+        "required_services" : [
+          "ZOOKEEPER",
+          "YARN"
+        ],
         "config_types" : {
           "hive-env" : {
             "supports" : {
@@ -738,6 +762,9 @@ module.exports = {
         "stack_name" : "HDP",
         "stack_version" : "2.1",
         "user_name" : null,
+        "required_services" : [
+          "YARN"
+        ],
         "config_types" : {
           "core-site" : {
             "supports" : {
@@ -823,6 +850,7 @@ module.exports = {
         "stack_name" : "HDP",
         "stack_version" : "2.1",
         "user_name" : null,
+        "required_services" : [ ],
         "config_types" : {
           "nagios-env" : {
             "supports" : {
@@ -923,6 +951,9 @@ module.exports = {
         "stack_name" : "HDP",
         "stack_version" : "2.1",
         "user_name" : null,
+        "required_services" : [
+          "YARN"
+        ],
         "config_types" : {
           "oozie-env" : {
             "supports" : {
@@ -1045,6 +1076,9 @@ module.exports = {
         "stack_name" : "HDP",
         "stack_version" : "2.1",
         "user_name" : null,
+        "required_services" : [
+          "YARN"
+        ],
         "config_types" : {
           "pig-env" : {
             "supports" : {
@@ -1094,6 +1128,9 @@ module.exports = {
         "stack_name" : "HDP",
         "stack_version" : "2.1",
         "user_name" : null,
+        "required_services" : [
+          "HDFS"
+        ],
         "config_types" : {
           "sqoop-env" : {
             "supports" : {
@@ -1154,6 +1191,9 @@ module.exports = {
         "stack_name" : "HDP",
         "stack_version" : "2.1",
         "user_name" : null,
+        "required_services" : [
+          "ZOOKEEPER"
+        ],
         "config_types" : {
           "storm-env" : {
             "supports" : {
@@ -1273,6 +1313,9 @@ module.exports = {
         "stack_name" : "HDP",
         "stack_version" : "2.1",
         "user_name" : null,
+        "required_services" : [
+          "YARN"
+        ],
         "config_types" : {
           "tez-env" : {
             "supports" : {
@@ -1317,6 +1360,10 @@ module.exports = {
         "stack_name" : "HDP",
         "stack_version" : "2.1",
         "user_name" : null,
+        "required_services" : [
+          "HIVE",
+          "ZOOKEEPER"
+        ],
         "config_types" : {
           "webhcat-env" : {
             "supports" : {
@@ -1412,6 +1459,10 @@ module.exports = {
         "stack_name" : "HDP",
         "stack_version" : "2.1",
         "user_name" : null,
+        "required_services" : [
+          "HDFS",
+          "TEZ"
+        ],
         "config_types" : {
           "capacity-scheduler" : {
             "supports" : {
@@ -1522,6 +1573,7 @@ module.exports = {
         "stack_name" : "HDP",
         "stack_version" : "2.1",
         "user_name" : null,
+        "required_services" : [ ],
         "config_types" : {
           "zoo.cfg" : {
             "supports" : {


Mime
View raw message