ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akovale...@apache.org
Subject ambari git commit: AMBARI-18931. Can't change capacity-scheduler's queue capacity from the YARN config page, even though its shown as text box (akovalenko)
Date Fri, 18 Nov 2016 21:04:05 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.5 a5d4c6957 -> f1a25944c


AMBARI-18931. Can't change capacity-scheduler's queue capacity from the YARN config page,
even though its shown as text box (akovalenko)


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

Branch: refs/heads/branch-2.5
Commit: f1a25944ca7f2e0424b9249b206106fb6d6cef95
Parents: a5d4c69
Author: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Authored: Fri Nov 18 18:50:37 2016 +0200
Committer: Aleksandr Kovalenko <akovalenko@hortonworks.com>
Committed: Fri Nov 18 23:02:52 2016 +0200

----------------------------------------------------------------------
 .../configs/config_recommendation_parser.js     | 20 ++++++++++----
 .../common/configs/config_recommendations.js    |  2 +-
 .../mixins/common/configs/enhanced_configs.js   | 28 +++++++++++++++++---
 ambari-web/app/views/common/controls_view.js    | 11 ++++++--
 4 files changed, 49 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f1a25944/ambari-web/app/mixins/common/configs/config_recommendation_parser.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/configs/config_recommendation_parser.js b/ambari-web/app/mixins/common/configs/config_recommendation_parser.js
index b88cf62..b014ede 100644
--- a/ambari-web/app/mixins/common/configs/config_recommendation_parser.js
+++ b/ambari-web/app/mixins/common/configs/config_recommendation_parser.js
@@ -155,11 +155,21 @@ App.ConfigRecommendationParser = Em.Mixin.create(App.ConfigRecommendations,
{
 
     Em.set(config, 'recommendedValue', recommendedValue);
     if (this.allowUpdateProperty(parentProperties, Em.get(config, 'name'), Em.get(config,
'filename'))) {
-      Em.setProperties(config, {
-        value: recommendedValue,
-        errorMessage: '',
-        warnMessage: ''
-      });
+      var allowConfigUpdate = true;
+      // workaround for capacity-scheduler
+      if (this.get('currentlyChangedConfig')) {
+        var cId = App.config.configId(this.get('currentlyChangedConfig.name'), this.get('currentlyChangedConfig.fileName'));
+        if (App.config.configId(config.get('name'), config.get('filename')) === cId) {
+          allowConfigUpdate = false;
+        }
+      }
+      if (allowConfigUpdate) {
+        Em.setProperties(config, {
+          value: recommendedValue,
+          errorMessage: '',
+          warnMessage: ''
+        });
+      }
       if (!Em.isNone(recommendedValue) && !Em.get(config, 'hiddenBySection')) {
         Em.set(config, 'isVisible', true);
       }

http://git-wip-us.apache.org/repos/asf/ambari/blob/f1a25944/ambari-web/app/mixins/common/configs/config_recommendations.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/configs/config_recommendations.js b/ambari-web/app/mixins/common/configs/config_recommendations.js
index 79d6f5d..7427a54 100644
--- a/ambari-web/app/mixins/common/configs/config_recommendations.js
+++ b/ambari-web/app/mixins/common/configs/config_recommendations.js
@@ -227,4 +227,4 @@ App.ConfigRecommendations = Em.Mixin.create({
     this.set('recommendations', filteredRecommendations);
   }
 
-});
\ No newline at end of file
+});

http://git-wip-us.apache.org/repos/asf/ambari/blob/f1a25944/ambari-web/app/mixins/common/configs/enhanced_configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/configs/enhanced_configs.js b/ambari-web/app/mixins/common/configs/enhanced_configs.js
index 46bdb46..88dac74 100644
--- a/ambari-web/app/mixins/common/configs/enhanced_configs.js
+++ b/ambari-web/app/mixins/common/configs/enhanced_configs.js
@@ -62,6 +62,14 @@ App.EnhancedConfigsMixin = Em.Mixin.create(App.ConfigWithOverrideRecommendationP
    */
   isControllerSupportsEnhancedConfigs: Em.computed.existsIn('name', ['wizardStep7Controller','mainServiceInfoConfigsController']),
 
+  /**
+   * Stores name and file name of changed config
+   * This used only for capacity-scheduler
+   *
+   * @property {object}
+   */
+  currentlyChangedConfig: null,
+
   dependenciesGroupMessage: Em.I18n.t('popup.dependent.configs.dependencies.for.groups'),
   /**
    * message fro alert box for dependent configs
@@ -172,6 +180,14 @@ App.EnhancedConfigsMixin = Em.Mixin.create(App.ConfigWithOverrideRecommendationP
       if (updateDependencies) {
         dataToSend.changed_configurations = changedConfigs;
       }
+      if (Em.isArray(changedConfigs) && changedConfigs.mapProperty('type').uniq()[0]
=== 'capacity-scheduler') {
+        this.set('currentlyChangedConfig', {
+          name: 'capacity-scheduler',
+          fileName: 'capacity-scheduler.xml'
+        });
+      } else {
+        this.set('currentlyChangedConfig', null);
+      }
 
       if (configGroup && !configGroup.get('isDefault') && configGroup.get('hosts.length')
> 0) {
         recommendations.config_groups = [this.buildConfigGroupJSON(this.get('selectedService.configs'),
configGroup)];
@@ -235,9 +251,13 @@ App.EnhancedConfigsMixin = Em.Mixin.create(App.ConfigWithOverrideRecommendationP
     return this.get('selectedConfigGroup.isDefault') && !Em.isNone(this.get('recommendationsConfigs'))
       && !this.get('stepConfigs').filter(function(stepConfig) {
       return stepConfig.get('changedConfigProperties').filter(function(c) {
-        return !this.get('changedProperties').map(function(changed) {
+        var changedConfigIds = this.get('changedProperties').map(function(changed) {
           return App.config.configId(changed.propertyName, changed.propertyFileName);
-        }).contains(App.config.configId(c.get('name'), c.get('filename')));
+        });
+        if (this.get('currentlyChangedConfig')) {
+          return changedConfigIds.contains(App.config.configId(this.get('currentlyChangedConfig.name'),
this.get('currentlyChangedConfig.fileName')));
+        }
+        return !changedConfigIds.contains(App.config.configId(c.get('name'), c.get('filename')));
       }, this).length;
     }, this).length;
   },
@@ -414,13 +434,13 @@ App.EnhancedConfigsMixin = Em.Mixin.create(App.ConfigWithOverrideRecommendationP
       }
     }, this);
   },
-  
+
   saveInitialRecommendations: function() {
     this.get('recommendations').forEach(function (r) {
       this.get('initialRecommendations').pushObject(r);
     }, this);
   },
-  
+
   /**
    * disable saving recommended value for current config
    * @param config

http://git-wip-us.apache.org/repos/asf/ambari/blob/f1a25944/ambari-web/app/views/common/controls_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/controls_view.js b/ambari-web/app/views/common/controls_view.js
index e4b52cb..545e196 100644
--- a/ambari-web/app/views/common/controls_view.js
+++ b/ambari-web/app/views/common/controls_view.js
@@ -313,12 +313,19 @@ App.CapacitySceduler = App.ServiceConfigTextArea.extend({
     if (!config.get('isValid') && config.get('isNotDefaultValue')) return $.Deferred().resolve().promise();
     controller = controller || this.get('controller');
     if (controller && ['mainServiceInfoConfigsController','wizardStep7Controller'].contains(controller.get('name')))
{
-      return controller.loadConfigRecommendations(config.get('value').split('\n').map(function
(_property) {
+      var schedulerConfigs = config.get('value').split('\n').map(function (_property) {
         return {
           "type": 'capacity-scheduler',
           "name": _property.split('=')[0]
         }
-      }));
+      });
+      if (!schedulerConfigs.someProperty('name', 'capacity-scheduler')) {
+        schedulerConfigs.push({
+          "type": 'capacity-scheduler',
+          "name": 'capacity-scheduler'
+        });
+      }
+      return controller.loadConfigRecommendations(schedulerConfigs);
     }
 
     return $.Deferred().resolve().promise();


Mime
View raw message