You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ab...@apache.org on 2014/11/13 13:52:03 UTC
[2/2] ambari git commit: AMBARI-8306 remove code for UI
recommendation/validation. (ababiichuk)
AMBARI-8306 remove code for UI recommendation/validation. (ababiichuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ab48cfbf
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ab48cfbf
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ab48cfbf
Branch: refs/heads/trunk
Commit: ab48cfbf041a22c48cea3bc29571d1a17a498fa6
Parents: eaa54b3
Author: aBabiichuk <ab...@cybervisiontech.com>
Authored: Thu Nov 13 14:21:19 2014 +0200
Committer: aBabiichuk <ab...@cybervisiontech.com>
Committed: Thu Nov 13 14:21:19 2014 +0200
----------------------------------------------------------------------
ambari-web/app/assets/test/tests.js | 4 -
.../controllers/main/service/info/configs.js | 181 -----------
.../app/controllers/wizard/step7_controller.js | 118 +------
ambari-web/app/data/service_configs.js | 6 -
ambari-web/app/models/stack_service.js | 30 --
.../defaults_providers/defaultsProvider.js | 46 ---
.../hive_defaults_provider.js | 44 ---
.../oozie_defaults_provider.js | 43 ---
.../storm_defaults_provider.js | 52 ---
.../defaults_providers/tez_defaults_provider.js | 40 ---
.../user_defaults_provider.js | 54 ----
.../yarn_defaults_provider.js | 315 ------------------
.../validators/hive_configs_validator.js | 42 ---
.../validators/mapreduce2_configs_validator.js | 64 ----
.../validators/service_configs_validator.js | 150 ---------
.../validators/storm_configs_validator.js | 42 ---
.../configs/validators/tez_configs_validator.js | 38 ---
.../validators/user_configs_validator.js | 55 ----
.../validators/yarn_configs_validator.js | 43 ---
.../main/service/info/config_test.js | 4 -
ambari-web/test/models/stack_service_test.js | 26 --
.../hive_defaults_provider_test.js | 162 ----------
.../tez_defaults_provider_test.js | 126 --------
.../yarn_defaults_provider_test.js | 317 -------------------
.../service_configs_validator_test.js | 307 ------------------
25 files changed, 1 insertion(+), 2308 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/ab48cfbf/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 09cc4e8..aab4bf2 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -113,10 +113,6 @@ var files = ['test/init_model_test',
'test/mixins/common/chart/storm_linear_time_test',
'test/mixins/common/localStorage_test',
'test/mixins/main/host/details/host_components/decommissionable_test',
- 'test/utils/configs/defaults_providers/yarn_defaults_provider_test',
- 'test/utils/configs/defaults_providers/tez_defaults_provider_test',
- 'test/utils/configs/defaults_providers/hive_defaults_provider_test',
- 'test/utils/configs/validators/service_configs_validator_test',
'test/utils/ajax/ajax_test',
'test/utils/ajax/ajax_queue_test',
'test/utils/batch_scheduled_requests_test',
http://git-wip-us.apache.org/repos/asf/ambari/blob/ab48cfbf/ambari-web/app/controllers/main/service/info/configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/info/configs.js b/ambari-web/app/controllers/main/service/info/configs.js
index 27d726c..6ed0d72 100644
--- a/ambari-web/app/controllers/main/service/info/configs.js
+++ b/ambari-web/app/controllers/main/service/info/configs.js
@@ -247,8 +247,6 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
restartHosts: Em.A(),
- //TODO after moving validation/recommendation to BE defaultsInfo must be deleted
- defaultsInfo: null,
/**
* On load function
*/
@@ -856,21 +854,6 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
this.set('isInit', false);
},
- //TODO after moving validation/recommendation to BE getInfoForDefaults must be deleted
- setDefaults: function(){
- var serviceConfig = App.config.createServiceConfig(this.get('content.serviceName'));
- this.loadConfigs(this.get('allConfigs'), serviceConfig);
- this.checkOverrideProperty(serviceConfig);
- this.checkDatabaseProperties(serviceConfig);
- this.get('stepConfigs').pushObject(serviceConfig);
- this.set('selectedService', this.get('stepConfigs').objectAt(0));
- this.checkForSecureConfig(this.get('selectedService'));
- this.set('versionLoaded', true);
- this.set('dataIsLoaded', true);
- this.set('hash', this.getHash());
- this.set('isInit', false);
- }.observes('defaultsInfo'),
-
/**
* Changes format from Object to Array
*
@@ -921,117 +904,6 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
}, this)
},
- //TODO after moving validation/recommendation to BE getInfoForDefaults must be deleted
- /**
- * Get info about hosts and host components to configDefaultsProviders
- * @returns {{masterComponentHosts: Array, slaveComponentHosts: Array, hosts: {}}}
- */
- getInfoForDefaults: function (providers) {
- var requiredComponents = [];
-
- providers.forEach(function (provider) {
- requiredComponents = provider.get('slaveHostDependency').concat(provider.get('masterHostDependency'));
- });
-
- if (requiredComponents.length > 0) {
- App.ajax.send({
- name: 'hosts.by_component.' + ((requiredComponents.length === 1) ? 'one' : 'all'),
- sender: this,
- data: {
- componentNames: requiredComponents.join(',')
- },
- success: 'getInfoForDefaultsSuccessCallback'
- });
- } else {
- //if no components required then slaveComponentHosts and hosts stay empty
- this.set('defaultsInfo', {
- masterComponentHosts: this.getMasterComponents(),
- slaveComponentHosts: [],
- hosts: {}
- });
- }
- },
-
- //TODO after moving validation/recommendation to BE getInfoForDefaultsSuccessCallback must be deleted
- getInfoForDefaultsSuccessCallback: function (response) {
- var defaultsInfo = {
- masterComponentHosts: this.getMasterComponents(),
- slaveComponentHosts: this.getSlaveComponents(response),
- hosts: this.getHostsInfo(response)
- };
- this.set('defaultsInfo', defaultsInfo);
- this.setRecommendedDefaults(this.get('advancedConfigs'));
- },
-
- //TODO after moving validation/recommendation to BE getSlaveComponents must be deleted
- /**
- * parse json response and build slave components array
- * @param response
- * @return {Array}
- */
- getSlaveComponents: function (response) {
- var hostComponentMap = {};
- var slaves = App.StackServiceComponent.find().filterProperty('isSlave').mapProperty('componentName');
- var slaveComponentHosts = [];
-
- response.items.forEach(function (host) {
- host.host_components.forEach(function (hostComponent) {
- if (slaves.contains(hostComponent.HostRoles.component_name)) {
- if (!hostComponentMap[hostComponent.HostRoles.component_name]) {
- hostComponentMap[hostComponent.HostRoles.component_name] = [];
- }
- hostComponentMap[hostComponent.HostRoles.component_name].push({hostName: host.Hosts.host_name});
- }
- })
- });
-
- for (var componentName in hostComponentMap) {
- slaveComponentHosts.push({
- componentName: componentName,
- hosts: hostComponentMap[componentName]
- });
- }
- return slaveComponentHosts;
- },
-
- //TODO after moving validation/recommendation to BE getMasterComponents must be deleted
- /**
- * build master components array of data from HostComponent model
- * @return {Array}
- */
- getMasterComponents: function () {
- var masterComponentHosts = [];
-
- App.HostComponent.find().filterProperty('isMaster').forEach(function (masterComponent) {
- masterComponentHosts.push({
- component: masterComponent.get('componentName'),
- serviceId: masterComponent.get('service.serviceName'),
- host: masterComponent.get('hostName')
- });
- });
- return masterComponentHosts;
- },
-
- //TODO after moving validation/recommendation to BE getHostsInfo must be deleted
- /**
- * parse json response and build hosts map
- * @param response
- * @return {Object}
- */
- getHostsInfo: function (response) {
- var hosts = {};
-
- response.items.mapProperty('Hosts').map(function (host) {
- hosts[host.host_name] = {
- name: host.host_name,
- cpu: host.cpu_count,
- memory: host.total_mem,
- disk_info: host.disk_info
- };
- });
- return hosts;
- },
-
/**
* Load child components to service config object
* @param {Array} configs - array of configs
@@ -1067,7 +939,6 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
var serviceConfigProperty = App.ServiceConfigProperty.create(_serviceConfigProperty);
this.setValueForCheckBox(serviceConfigProperty);
- this.setValidator(serviceConfigProperty, serviceConfigsData);
this.setSupportsFinal(serviceConfigProperty);
this.setValuesForOverrides(overrides, _serviceConfigProperty, serviceConfigProperty, defaultGroupSelected);
this.setEditability(serviceConfigProperty, defaultGroupSelected);
@@ -1093,37 +964,6 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
}
},
- //TODO after moving validation/recommendation to BE setRecommendedDefaults must be deleted
- /**
- * set recommended defaults for advanced configs for current service
- * @param {Array} advancedConfigs
- * @mrethod setRecommendedDefaults
- */
- setRecommendedDefaults: function (advancedConfigs) {
- var s = App.StackService.find().findProperty('serviceName', this.get('content.serviceName'));
- var defaultsProvider = s.get('defaultsProviders');
- var configsValidator = s.get('configsValidator');
- var localDB = this.get('defaultsInfo');
- var recommendedDefaults = {};
- if (defaultsProvider) {
- defaultsProvider.forEach(function (defaultsProvider) {
- var d = defaultsProvider.getDefaults(localDB);
- for (var name in d) {
- if (!!d[name]) {
- recommendedDefaults[name] = d[name];
- } else {
- var defaultValueFromStack = advancedConfigs.findProperty('name', name);
- // If property default value is not declared on client, fetch it from stack definition
- // If it's not declared with any valid value in both server stack and client, then js reference error is expected to be thrown
- recommendedDefaults[name] = defaultValueFromStack && defaultValueFromStack.value
- }
- }
- });
- }
- if (configsValidator) {
- configsValidator.set('recommendedDefaults', recommendedDefaults);
- }
- },
/**
* set isEditable property of config for admin
* if default cfg group and not on the host config page
@@ -1156,27 +996,6 @@ App.MainServiceInfoConfigsController = Em.Controller.extend(App.ServerValidatorM
},
/**
- * set serviceValidator for config property
- * hide properties for other services
- * @param {Ember.Object} serviceConfigProperty
- * @param {Object} serviceConfigsData
- * @method setValidator
- */
- setValidator: function (serviceConfigProperty, serviceConfigsData) {
- if (serviceConfigProperty.get('serviceName') === this.get('content.serviceName')) {
- if (serviceConfigsData.get('configsValidator')) {
- for (var validatorName in serviceConfigsData.get('configsValidator.configValidators')) {
- if (serviceConfigProperty.get("name") == validatorName) {
- serviceConfigProperty.set('serviceValidator', serviceConfigsData.get('configsValidator'));
- }
- }
- }
- } else {
- serviceConfigProperty.set('isVisible', false);
- }
- },
-
- /**
* set override values
* @param overrides
* @param _serviceConfigProperty
http://git-wip-us.apache.org/repos/asf/ambari/blob/ab48cfbf/ambari-web/app/controllers/wizard/step7_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/wizard/step7_controller.js b/ambari-web/app/controllers/wizard/step7_controller.js
index 29f37d4..cfe1888 100644
--- a/ambari-web/app/controllers/wizard/step7_controller.js
+++ b/ambari-web/app/controllers/wizard/step7_controller.js
@@ -404,91 +404,6 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, {
service.set('configs', serviceConfig.get('configs'));
},
- //TODO after moving validation/recommendation to BE _getRecommendedDefaultsForComponent must be deleted
- /**
- * Get object with recommended default values for config properties
- * Format:
- * <code>
- * {
- * configName1: configValue1,
- * configName2: configValue2
- * ...
- * }
- * </code>
- * @param {string} serviceName
- * @returns {object}
- * @method _getRecommendedDefaultsForComponent
- */
- _getRecommendedDefaultsForComponent: function (serviceName) {
- var s = App.StackService.find(serviceName),
- recommendedDefaults = {},
- localDB = this.getInfoForDefaults();
- if (s.get('defaultsProvider')) {
- s.get('defaultsProvider').forEach(function (defaultsProvider) {
- var d = defaultsProvider.getDefaults(localDB);
- for (var name in d) {
- if (d.hasOwnProperty(name)) {
- recommendedDefaults[name] = d[name];
- }
- }
- });
- }
- return recommendedDefaults;
- },
-
- //TODO after moving validation/recommendation to BE getInfoForDefaults must be deleted
- /**
- * Get info about hosts and host components to configDefaultsProviders
- * Work specifically in Add Service wizard
- * @slaveComponentHosts - contains slaves and clients as well
- * @returns {{masterComponentHosts: Array, slaveComponentHosts: Array, hosts: {}}}
- */
- getInfoForDefaults: function () {
- var slaveComponentHosts = [];
- var hosts = this.get('content.hosts');
- var slaveHostMap = {};
-
- //get clients and slaves from stack
- App.StackServiceComponent.find().forEach(function (component) {
- if (component.get('isClient') || component.get('isSlave')) {
- slaveHostMap[component.get('componentName')] = [];
- }
- });
-
- //assign hosts of every component
- for (var hostName in hosts) {
- hosts[hostName].hostComponents.forEach(function (componentName) {
- if (slaveHostMap[componentName]) {
- slaveHostMap[componentName].push({hostName: hostName});
- }
- });
- }
-
- //push slaves and clients into @slaveComponentHosts
- for (var componentName in slaveHostMap) {
- if (slaveHostMap[componentName].length > 0) {
- slaveComponentHosts.push({
- componentName: componentName,
- hosts: slaveHostMap[componentName]
- })
- }
- }
-
- var masterComponentHosts = App.HostComponent.find().filterProperty('isMaster', true).map(function (item) {
- return {
- component: item.get('componentName'),
- serviceId: item.get('service.serviceName'),
- host: item.get('hostName')
- }
- });
-
- return {
- masterComponentHosts: masterComponentHosts,
- slaveComponentHosts: slaveComponentHosts,
- hosts: hosts
- };
- },
-
/**
* By default <code>value</code>-property is string "true|false".
* Should update it to boolean type
@@ -580,35 +495,6 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, {
},
/**
- * Set <code>serviceValidator</code>-property to <code>serviceConfigProperty</code> if config's serviceName is equal
- * to component's serviceName
- * othervise set <code>isVisible</code>-property to <code>false</code>
- * @param {Ember.Object} serviceConfigProperty
- * @param {Ember.Object} component
- * @param {object} serviceConfigsData
- * @returns {Ember.Object} updated config-object
- * @mrthod _updateValidatorsForConfig
- */
- _updateValidatorsForConfig: function (serviceConfigProperty, component, serviceConfigsData) {
- if (serviceConfigProperty.get('serviceName') === component.get('serviceName')) {
- if (serviceConfigsData.get('configsValidator')) {
- var validators = serviceConfigsData.get('configsValidator').get('configValidators');
- for (var validatorName in validators) {
- if (validators.hasOwnProperty(validatorName)) {
- if (serviceConfigProperty.get('name') == validatorName) {
- serviceConfigProperty.set('serviceValidator', serviceConfigsData.get('configsValidator'));
- }
- }
- }
- }
- }
- else {
- serviceConfigProperty.set('isVisible', false);
- }
- return serviceConfigProperty;
- },
-
- /**
* Set configs with overrides, recommended defaults to component
* @param {Ember.Object[]} configs
* @param {Ember.Object} componentConfig
@@ -616,8 +502,7 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, {
* @method loadComponentConfigs
*/
loadComponentConfigs: function (configs, componentConfig, component) {
- var s = App.StackService.find(component.get('serviceName')),
- defaultGroupSelected = component.get('selectedConfigGroup.isDefault');
+ var defaultGroupSelected = component.get('selectedConfigGroup.isDefault');
configs.forEach(function (serviceConfigProperty) {
if (!serviceConfigProperty) return;
@@ -628,7 +513,6 @@ App.WizardStep7Controller = Em.Controller.extend(App.ServerValidatorMixin, {
if (serviceConfigProperty.get('displayType') === 'checkbox') {
this._updateValueForCheckBoxConfig(serviceConfigProperty);
}
- this._updateValidatorsForConfig(serviceConfigProperty, component, s);
this._updateOverridesForConfig(serviceConfigProperty, component);
this._updateIsEditableFlagForConfig(serviceConfigProperty, defaultGroupSelected);
http://git-wip-us.apache.org/repos/asf/ambari/blob/ab48cfbf/ambari-web/app/data/service_configs.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/service_configs.js b/ambari-web/app/data/service_configs.js
index 5b33345..1f0cbb5 100644
--- a/ambari-web/app/data/service_configs.js
+++ b/ambari-web/app/data/service_configs.js
@@ -18,9 +18,6 @@
var App = require('app');
require('models/service_config');
-//TODO after moving validation/recommendation to BE belov requirement must be deleted
-require('utils/configs/defaults_providers/user_defaults_provider');
-require('utils/configs/validators/user_configs_validator');
/**
* This
@@ -30,9 +27,6 @@ module.exports = [
Em.Object.create({
serviceName: 'MISC',
displayName: 'Misc',
- //TODO after moving validation/recommendation to BE configsValidator and defaultsProviders must be deleted
- configsValidator: App.userConfigsValidator,
- defaultsProviders: [App.userDefaultsProvider.create()],
configCategories: [
App.ServiceConfigCategory.create({ name: 'General', displayName : 'General'}),
App.ServiceConfigCategory.create({ name: 'Users and Groups', displayName : 'Users and Groups'})
http://git-wip-us.apache.org/repos/asf/ambari/blob/ab48cfbf/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 c3553a7..64516a0 100644
--- a/ambari-web/app/models/stack_service.js
+++ b/ambari-web/app/models/stack_service.js
@@ -19,17 +19,6 @@
var App = require('app');
require('utils/helper');
require('models/service_config');
-//TODO after moving validation/recommendation to BE belove requirements must be deleted
-require('utils/configs/defaults_providers/yarn_defaults_provider');
-require('utils/configs/defaults_providers/tez_defaults_provider');
-require('utils/configs/defaults_providers/hive_defaults_provider');
-require('utils/configs/defaults_providers/storm_defaults_provider');
-require('utils/configs/defaults_providers/oozie_defaults_provider');
-require('utils/configs/validators/yarn_configs_validator');
-require('utils/configs/validators/hive_configs_validator');
-require('utils/configs/validators/tez_configs_validator');
-require('utils/configs/validators/mapreduce2_configs_validator');
-require('utils/configs/validators/storm_configs_validator');
/**
* This model loads all services supported by the stack
@@ -135,16 +124,6 @@ App.StackService = DS.Model.extend({
customReviewHandler: function () {
return App.StackService.reviewPageHandlers[this.get('serviceName')];
}.property('serviceName'),
- //TODO after moving validation/recommendation to BE defaultsProviders must be deleted
- defaultsProviders: function () {
- var defaultConfigsHandler = App.StackService.defaultConfigsHandler[this.get('serviceName')];
- return defaultConfigsHandler && defaultConfigsHandler.defaultsProviders;
- }.property('serviceName'),
- //TODO after moving validation/recommendation to BE configsValidator must be deleted
- configsValidator: function () {
- var defaultConfigsHandler = App.StackService.defaultConfigsHandler[this.get('serviceName')];
- return defaultConfigsHandler && defaultConfigsHandler.configsValidator;
- }.property('serviceName'),
/**
* configCategories are fetched from App.StackService.configCategories.
@@ -212,15 +191,6 @@ App.StackService.reviewPageHandlers = {
}
};
-//TODO after moving validation/recommendation to BE defaultConfigsHandler must be deleted
-App.StackService.defaultConfigsHandler = {
- YARN: {defaultsProviders: [App.YARNDefaultsProvider.create()], configsValidator: App.YARNConfigsValidator},
- MAPREDUCE2: {defaultsProviders: [App.YARNDefaultsProvider.create()], configsValidator: App.MapReduce2ConfigsValidator},
- HIVE: {defaultsProviders: [App.HiveDefaultsProvider.create()], configsValidator: App.HiveConfigsValidator},
- STORM: {defaultsProviders: [App.STORMDefaultsProvider.create()], configsValidator: App.STORMConfigsValidator},
- TEZ: {defaultsProviders: [App.TezDefaultsProvider.create()], configsValidator: App.TezConfigsValidator}
-};
-
App.StackService.configCategories = function () {
var serviceConfigCategories = [];
switch (this.get('serviceName')) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/ab48cfbf/ambari-web/app/utils/configs/defaults_providers/defaultsProvider.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/defaults_providers/defaultsProvider.js b/ambari-web/app/utils/configs/defaults_providers/defaultsProvider.js
deleted file mode 100644
index fffbea6..0000000
--- a/ambari-web/app/utils/configs/defaults_providers/defaultsProvider.js
+++ /dev/null
@@ -1,46 +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.DefaultsProvider = Em.Object.extend({
-
- /**
- * contains slave components assigned to hosts which has info required by config provider
- */
- slaveHostDependency: [],
- /**
- * contains master components assigned to hosts which has info required by config provider
- */
- masterHostDependency: [],
-
- /**
- * Look at cluster setup, the provided properties, and provide an object where keys are property-names, and values are the recommended defaults
- * @param {App.ServiceConfigProperty} serviceConfigProperty
- */
- getDefaults: function(serviceConfigProperty) {
-
- },
-
- /**
- * Cluster info used to calculate properties values
- * Should be redeclared in the child providers
- */
- getClusterData: function() {
-
- }
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/ab48cfbf/ambari-web/app/utils/configs/defaults_providers/hive_defaults_provider.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/defaults_providers/hive_defaults_provider.js b/ambari-web/app/utils/configs/defaults_providers/hive_defaults_provider.js
deleted file mode 100644
index 95f352d..0000000
--- a/ambari-web/app/utils/configs/defaults_providers/hive_defaults_provider.js
+++ /dev/null
@@ -1,44 +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('utils/configs/defaults_providers/yarn_defaults_provider');
-
-App.HiveDefaultsProvider = App.YARNDefaultsProvider.extend({
-
- configsTemplate: {
- 'hive.tez.container.size': null,
- 'hive.tez.java.opts': null,
- 'hive.auto.convert.join.noconditionaltask.size': null
- },
-
- getDefaults: function (localDB) {
- var configs = this._super(localDB);
- if (configs['yarn.scheduler.maximum-allocation-mb'] != null && configs['mapreduce.map.memory.mb'] != null
- && configs['mapreduce.reduce.memory.mb'] != null) {
- var containerSize = configs['mapreduce.map.memory.mb'] > 2048 ? configs['mapreduce.map.memory.mb'] : configs['mapreduce.reduce.memory.mb'];
- containerSize = Math.min(configs['yarn.scheduler.maximum-allocation-mb'], containerSize);
- configs['hive.auto.convert.join.noconditionaltask.size'] = Math.round(containerSize / 3) * 1048576; // MB to Bytes
- configs['hive.tez.java.opts'] = "-server -Xmx" + Math.round(0.8 * containerSize) + "m -Djava.net.preferIPv4Stack=true -XX:NewRatio=8 -XX:+UseNUMA -XX:+UseParallelGC";
- configs['hive.tez.container.size'] = containerSize;
- } else {
- jQuery.extend(configs, this.get('configsTemplate'));
- }
- return configs;
- }
-
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/ab48cfbf/ambari-web/app/utils/configs/defaults_providers/oozie_defaults_provider.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/defaults_providers/oozie_defaults_provider.js b/ambari-web/app/utils/configs/defaults_providers/oozie_defaults_provider.js
deleted file mode 100644
index 73da766..0000000
--- a/ambari-web/app/utils/configs/defaults_providers/oozie_defaults_provider.js
+++ /dev/null
@@ -1,43 +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('utils/configs/defaults_providers/defaultsProvider');
-
-App.OOZIEDefaultsProvider = App.DefaultsProvider.extend({
-
- clusterData: null,
-
- /**
- * List of the configs that should be calculated
- */
- configsTemplate: {
- 'oozie.services.ext': null
- },
-
-
- getDefaults: function (localDB) {
- this._super();
- this.getClusterData(localDB);
- var configs = {};
- jQuery.extend(configs, this.get('configsTemplate'));
- if (localDB.masterComponentHosts.findProperty('component','FALCON_SERVER')) {
- configs['oozie.services.ext'] = "org.apache.oozie.service.JMSAccessorService,org.apache.oozie.service.PartitionDependencyManagerService,org.apache.oozie.service.HCatAccessorService";
- return configs;
- }
- }
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/ab48cfbf/ambari-web/app/utils/configs/defaults_providers/storm_defaults_provider.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/defaults_providers/storm_defaults_provider.js b/ambari-web/app/utils/configs/defaults_providers/storm_defaults_provider.js
deleted file mode 100644
index 2acf89a..0000000
--- a/ambari-web/app/utils/configs/defaults_providers/storm_defaults_provider.js
+++ /dev/null
@@ -1,52 +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('utils/configs/defaults_providers/defaultsProvider');
-
-App.STORMDefaultsProvider = App.DefaultsProvider.extend({
-
- clusterData: null,
-
- /**
- * List of the configs that should be calculated
- */
- configsTemplate: {
- 'drpc.childopts': null,
- 'ui.childopts': null,
- 'logviewer.childopts': null
- },
-
- // @todo fill with correct values
- getDefaults: function (localDB) {
- this._super();
- this.getClusterData(localDB);
- var configs = {};
- jQuery.extend(configs, this.get('configsTemplate'));
- if (!this.clusterDataIsValid()) {
- return configs;
- }
- return configs;
- },
-
- /**
- * Verify <code>clusterData</code> - check if all properties are defined
- */
- clusterDataIsValid: function () {
- return true;
- }
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/ab48cfbf/ambari-web/app/utils/configs/defaults_providers/tez_defaults_provider.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/defaults_providers/tez_defaults_provider.js b/ambari-web/app/utils/configs/defaults_providers/tez_defaults_provider.js
deleted file mode 100644
index 18a3109..0000000
--- a/ambari-web/app/utils/configs/defaults_providers/tez_defaults_provider.js
+++ /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.
- */
-
-var App = require('app');
-require('utils/configs/defaults_providers/yarn_defaults_provider');
-
-App.TezDefaultsProvider = App.YARNDefaultsProvider.extend({
-
- configsTemplate: {
- 'tez.am.resource.memory.mb': null,
- 'tez.am.java.opts': null
- },
-
- getDefaults : function(localDB) {
- var configs = this._super(localDB);
- if (configs['yarn.app.mapreduce.am.resource.mb'] != null) {
- configs['tez.am.resource.memory.mb'] = configs['yarn.app.mapreduce.am.resource.mb'];
- configs['tez.am.java.opts'] = '-server -Xmx' + Math.round(0.8 * configs['tez.am.resource.memory.mb'])
- + 'm -Djava.net.preferIPv4Stack=true -XX:+UseNUMA -XX:+UseParallelGC';
- } else {
- jQuery.extend(configs, this.get('configsTemplate'));
- }
- return configs;
- }
-
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/ab48cfbf/ambari-web/app/utils/configs/defaults_providers/user_defaults_provider.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/defaults_providers/user_defaults_provider.js b/ambari-web/app/utils/configs/defaults_providers/user_defaults_provider.js
deleted file mode 100644
index 345b257..0000000
--- a/ambari-web/app/utils/configs/defaults_providers/user_defaults_provider.js
+++ /dev/null
@@ -1,54 +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('utils/configs/defaults_providers/defaultsProvider');
-
-App.userDefaultsProvider = App.DefaultsProvider.extend({
-
- clusterData: null,
-
- /**
- * List of the configs that should be calculated
- */
- configsTemplate: {
- 'hdfs_user': null,
- 'mapred_user': null,
- 'yarn_user': null,
- 'hbase_user': null,
- 'hive_user': null,
- 'hcat_user': null,
- 'webhcat_user': null,
- 'oozie_user': null,
- 'falcon_user': null,
- 'storm_user': null,
- 'zk_user': null,
- 'gmetad_user': null,
- 'gmond_user': null,
- 'nagios_user': null,
- 'smokeuser': null
- },
-
- // @todo fill with correct values
- getDefaults: function (localDB) {
- this._super();
- var configs = {};
- jQuery.extend(configs, this.get('configsTemplate'));
- return configs;
- }
-});
-
http://git-wip-us.apache.org/repos/asf/ambari/blob/ab48cfbf/ambari-web/app/utils/configs/defaults_providers/yarn_defaults_provider.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/defaults_providers/yarn_defaults_provider.js b/ambari-web/app/utils/configs/defaults_providers/yarn_defaults_provider.js
deleted file mode 100644
index 16f5168..0000000
--- a/ambari-web/app/utils/configs/defaults_providers/yarn_defaults_provider.js
+++ /dev/null
@@ -1,315 +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('utils/configs/defaults_providers/defaultsProvider');
-
-App.YARNDefaultsProvider = App.DefaultsProvider.extend({
-
- slaveHostDependency: ['NODEMANAGER'],
-
- /**
- * List of the configs that should be calculated
- * @type {Object}
- */
- configsTemplate: {
- 'yarn.nodemanager.resource.memory-mb': null,
- 'yarn.scheduler.minimum-allocation-mb': null,
- 'yarn.scheduler.maximum-allocation-mb': null,
- 'mapreduce.map.memory.mb': null,
- 'mapreduce.reduce.memory.mb': null,
- 'mapreduce.map.java.opts': null,
- 'mapreduce.reduce.java.opts': null,
- 'mapreduce.task.io.sort.mb': null,
- 'yarn.app.mapreduce.am.resource.mb': null,
- 'yarn.app.mapreduce.am.command-opts': null
- },
-
- /**
- * Information about ram, disk count, cpu count and hbase availability
- * @type {{disk: number, ram: number, cpu: number, hBaseInstalled: bool}}
- */
- clusterData: null,
-
- /**
- * Reserved for system memory
- * @type {number}
- */
- reservedRam: null,
-
- /**
- * Reserved for HBase memory
- * @type {number}
- */
- hBaseRam: null,
-
- GB: 1024,
-
- /**
- * Minimum container size (in RAM).
- * This value is dependent on the amount of RAM available, as in smaller memory nodes the minimum container size should also be smaller
- *
- * Value in MB!
- *
- * @type {number}
- */
- recommendedMinimumContainerSize: function () {
- if (!this.clusterDataIsValid()) return null;
- var ram = this.get('clusterData.ram');
- switch(true) {
- case (ram <= 4): return 256;
- case (ram > 4 && ram <= 8): return 512;
- case (ram > 8 && ram <= 24): return 1024;
- case (ram > 24):
- default: return 2048;
- }
- }.property('clusterData.ram'),
-
- /**
- * Maximum number of containers allowed per node
- * max(3, min (2*cores,min (1.8*DISKS,(Total available RAM) / MIN_CONTAINER_SIZE))))
- * @type {number}
- */
- containers: function () {
- if (!this.clusterDataIsValid()) return null;
- var cpu = this.get('clusterData.cpu');
- var disk = this.get('clusterData.disk');
- var ram = this.get('clusterData.ram');
- var containerSize = this.get('recommendedMinimumContainerSize');
- cpu *= 2;
- disk = Math.ceil(disk * 1.8);
- ram -= this.get('reservedRam');
- if (this.get('clusterData.hBaseInstalled')) {
- ram -= this.get('hBaseRam');
- }
- // On low memory systems, memory left over after
- // removing reserved-RAM and HBase might be
- // less than 2GB (even negative). If so, we force
- // a 2GB value relying on virtual memory.
- if (ram < 2) {
- ram = 2;
- }
- ram *= this.get('GB');
- ram /= containerSize;
- return Math.round(Math.max(3, Math.min(cpu, Math.min(disk, ram))));
- }.property('clusterData.cpu', 'clusterData.ram', 'clusterData.hBaseInstalled', 'clusterData.disk', 'reservedRam', 'hBaseRam', 'recommendedMinimumContainerSize'),
-
- /**
- * Amount of RAM per container.
- * Calculated to be max(2GB, RAM - reservedRam - hBaseRam) / containers
- *
- * @return {number} Memory per container in MB. If greater than 1GB,
- * value will be in multiples of 512.
- */
- ramPerContainer: function () {
- var containers = this.get('containers');
- if (!containers) {
- return null;
- }
- var ram = this.get('clusterData.ram');
- ram = (ram - this.get('reservedRam'));
- if (this.get('clusterData.hBaseInstalled')) {
- ram -= this.get('hBaseRam');
- }
- // On low memory systems, memory left over after
- // removing reserved-RAM and HBase might be
- // less than 2GB (even negative). If so, we force
- // a 2GB value relying on virtual memory.
- if (ram < 2) {
- ram = 2;
- }
- ram *= this.get('GB');
- var container_ram = Math.abs(ram / containers);
- // If container memory is greater than 1GB,
- // we use multiples of 512 as value
- return container_ram > this.get('GB') ? (Math.floor(container_ram / 512) * 512) : container_ram;
- }.property('containers', 'clusterData.ram', 'clusterData.hBaseInstalled', 'hBaseRam', 'reservedRam'),
-
- /**
- * Memory for Map
- * @type {number}
- */
- mapMemory: function () {
- return Math.floor(this.get('ramPerContainer'));
- }.property('ramPerContainer'),
-
- /**
- * Memory for Reduce
- * @type {number}
- */
- reduceMemory: function () {
- return this.get('ramPerContainer');
- }.property('ramPerContainer'),
-
- /**
- * @type {number}
- */
- amMemory: function () {
- return Math.max(this.get('mapMemory'), this.get('reduceMemory'));
- }.property('mapMemory', 'reduceMemory'),
-
- /**
- * Reserved for HBase and system memory is based on total available memory
- * @type {number}
- */
- reservedMemoryRecommendations: function() {
- var table = [
- {os:1,hbase:1},
- {os:2,hbase:1},
- {os:2,hbase:2},
- {os:4,hbase:4},
- {os:6,hbase:8},
- {os:8,hbase:8},
- {os:8,hbase:8},
- {os:12,hbase:16},
- {os:24,hbase:24},
- {os:32,hbase:32},
- {os:64,hbase:64}
- ];
- var ram = this.get('clusterData.ram');
- var index = 0;
- switch (true) {
- case (ram <= 4): index = 0; break;
- case (ram > 4 && ram <= 8): index = 1; break;
- case (ram > 8 && ram <= 16): index = 2; break;
- case (ram > 16 && ram <= 24): index = 3; break;
- case (ram > 24 && ram <= 48): index = 4; break;
- case (ram > 48 && ram <= 64): index = 5; break;
- case (ram > 64 && ram <= 72): index = 6; break;
- case (ram > 72 && ram <= 96): index = 7; break;
- case (ram > 96 && ram <= 128): index = 8; break;
- case (ram > 128 && ram <= 256): index = 9; break;
- case (ram > 256 && ram <= 512): index = 10; break;
- default: index = 10; break;
- }
- this.set('reservedRam', table[index].os);
- this.set('hBaseRam', table[index].hbase);
- }.observes('clusterData.ram'),
-
- /**
- * Provide an object where keys are property-names and values are the recommended defaults
- * @param {object} localDB Object with information about hosts and master/slave components
- * Example:
- * <code>
- * {
- * "hosts": {
- * "host1": {
- * "name": "host1",
- * "cpu": 1,
- * "memory": "6123683.00",
- * "disk_info": [{
- * ....
- * },...]
- * },...
- * },
- * "masterComponentHosts": [{
- * "component": "NAMENODE",
- * "hostName": "host1",
- * "serviceId": "HDFS"
- * },...],
- * "slaveComponentHosts": [{
- * "componentName": "DATANODE",
- * "hosts": [{
- * "hostName": "host2"
- * }]
- * },...]
- * }
- * </code>
- * @return {object}
- */
- getDefaults: function (localDB) {
- this._super();
- this.getClusterData(localDB);
- var configs = {};
- jQuery.extend(configs, this.get('configsTemplate'));
- if (!this.clusterDataIsValid()) {
- return configs;
- }
- configs['yarn.nodemanager.resource.memory-mb'] = Math.round(this.get('containers') * this.get('ramPerContainer'));
- configs['yarn.scheduler.minimum-allocation-mb'] = Math.floor(this.get('ramPerContainer'));
- configs['yarn.scheduler.maximum-allocation-mb'] = Math.round(this.get('containers') * this.get('ramPerContainer'));
- configs['yarn.app.mapreduce.am.resource.mb'] = Math.floor(this.get('amMemory'));
- configs['yarn.app.mapreduce.am.command-opts'] = "-Xmx" + Math.round(0.8 * this.get('amMemory')) + "m";
- configs['mapreduce.map.memory.mb'] = Math.floor(this.get('mapMemory'));
- configs['mapreduce.reduce.memory.mb'] = Math.floor(this.get('reduceMemory'));
- configs['mapreduce.map.java.opts'] = "-Xmx" + Math.round(0.8 * this.get('mapMemory')) + "m";
- configs['mapreduce.reduce.java.opts'] = "-Xmx" + Math.round(0.8 * this.get('reduceMemory')) + "m";
- configs['mapreduce.task.io.sort.mb'] = Math.round(Math.min(0.4 * this.get('mapMemory'), 1024));
- return configs;
- },
-
- /**
- * Calculate needed cluster data (like disk count, cpu count, ram (in MB!) and hbase availability)
- * @param {object} localDB Object with information about hosts and master/slave components
- */
- getClusterData: function (localDB) {
- this._super();
- var components = this.get('slaveHostDependency').concat(this.get('masterHostDependency'));
- var hosts = [];
- if (!localDB.hosts || !(localDB.masterComponentHosts || localDB.slaveComponentHosts)) return;
- var hBaseInstalled = !!localDB.masterComponentHosts.filterProperty('component', 'HBASE_MASTER').length;
- components.forEach(function (component) {
- var mc = localDB.masterComponentHosts.findProperty('component', component);
- if (mc) {
- if (!hosts.contains(mc.hostName)) {
- hosts.push(mc.hostName);
- }
- }
- else {
- var sc = localDB.slaveComponentHosts.findProperty('componentName', component);
- if (sc) {
- sc.hosts.map(function (host) {
- if (!hosts.contains(host.hostName)) {
- hosts.push(host.hostName);
- }
- });
- }
- }
- });
- var clusterData = {
- cpu: 0,
- disk: 0,
- ram: 0,
- hBaseInstalled: hBaseInstalled
- };
- var host = hosts[0] && localDB.hosts[hosts[0]];
- if (host) {
- clusterData.cpu = parseInt(host.cpu);
- var length = 0;
- host.disk_info.forEach(function(disk) {
- //invalid mountpoints
- if (!(disk.mountpoint.startsWith('/home/') || disk.mountpoint.startsWith('/homes/') ||
- disk.mountpoint.startsWith('/dev/') || disk.mountpoint.startsWith('/tmp/'))) {
- length++;
- }
- },this);
- clusterData.disk = length;
- clusterData.ram = Math.round(parseFloat(host.memory) / (1024 * 1024));
- }
- this.set('clusterData', clusterData);
- },
-
- /**
- * Verify <code>clusterData</code> - check if all properties are defined
- * @return {bool}
- */
- clusterDataIsValid: function () {
- if (!this.get('clusterData')) return false;
- return !(this.get('clusterData.ram') == null || this.get('clusterData.cpu') == null || this.get('clusterData.disk') == null || this.get('clusterData.hBaseInstalled') == null);
- }
-
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/ab48cfbf/ambari-web/app/utils/configs/validators/hive_configs_validator.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/validators/hive_configs_validator.js b/ambari-web/app/utils/configs/validators/hive_configs_validator.js
deleted file mode 100644
index 5eb048d..0000000
--- a/ambari-web/app/utils/configs/validators/hive_configs_validator.js
+++ /dev/null
@@ -1,42 +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('utils/configs/validators/service_configs_validator');
-
-App.HiveConfigsValidator = App.ServiceConfigsValidator.create({
- /**
- * List of the configs that should be validated
- */
- configValidators: {
- 'hive.tez.container.size': 'hiveTezContainerMb',
- 'hive.tez.java.opts': 'hiveTezJavaOpts',
- 'hive.auto.convert.join.noconditionaltask.size': 'hiveTezJoinNoConditionalBytes'
- },
-
- hiveTezContainerMb: function(config) {
- return this.validatorLessThenDefaultValue(config);
- },
-
- hiveTezJavaOpts: function(config) {
- return this.validateXmxValue(config);
- },
-
- hiveTezJoinNoConditionalBytes: function(config) {
- return this.validatorLessThenDefaultValue(config);
- }
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/ab48cfbf/ambari-web/app/utils/configs/validators/mapreduce2_configs_validator.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/validators/mapreduce2_configs_validator.js b/ambari-web/app/utils/configs/validators/mapreduce2_configs_validator.js
deleted file mode 100644
index a469daa..0000000
--- a/ambari-web/app/utils/configs/validators/mapreduce2_configs_validator.js
+++ /dev/null
@@ -1,64 +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('utils/configs/validators/service_configs_validator');
-
-App.MapReduce2ConfigsValidator = App.ServiceConfigsValidator.create({
-
- /**
- * List of the configs that should be validated
- */
- configValidators: {
- 'mapreduce.map.java.opts': 'mapreduceMapJavaOpts',
- 'mapreduce.reduce.java.opts': 'mapreduceReduceJavaOpts',
- 'mapreduce.task.io.sort.mb': 'mapreduceTaskIoSortMb',
- 'mapreduce.map.memory.mb': 'mapreduceMapMemoryMb',
- 'mapreduce.reduce.memory.mb': 'mapreduceReduceMemoryMb',
- 'yarn.app.mapreduce.am.resource.mb': 'yarnAppMapreduceAmResourceMb',
- 'yarn.app.mapreduce.am.command-opts': 'yarnAppMapreduceAmCommandOpts'
- },
-
- mapreduceMapJavaOpts: function(config) {
- return this.validateXmxValue(config);
- },
-
- mapreduceReduceJavaOpts: function(config) {
- return this.validateXmxValue(config);
- },
-
- mapreduceTaskIoSortMb: function(config) {
- return this.validatorLessThenDefaultValue(config);
- },
-
- mapreduceMapMemoryMb: function(config) {
- return this.validatorLessThenDefaultValue(config);
- },
-
- mapreduceReduceMemoryMb: function(config) {
- return this.validatorLessThenDefaultValue(config);
- },
-
- yarnAppMapreduceAmResourceMb: function(config) {
- return this.validatorLessThenDefaultValue(config);
- },
-
- yarnAppMapreduceAmCommandOpts: function(config) {
- return this.validateXmxValue(config);
- }
-
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/ab48cfbf/ambari-web/app/utils/configs/validators/service_configs_validator.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/validators/service_configs_validator.js b/ambari-web/app/utils/configs/validators/service_configs_validator.js
deleted file mode 100644
index eec25d2..0000000
--- a/ambari-web/app/utils/configs/validators/service_configs_validator.js
+++ /dev/null
@@ -1,150 +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.ServiceConfigsValidator = Em.Object.extend({
-
- /**
- * Defaults recommended for various properties. This is to be used
- * by this validator to validate a property. Generally this value should be
- * set to values given by the defaults provider of the service.
- *
- * The key is the property name, and the value is the recommended default.
- */
- recommendedDefaults: {},
-
- /**
- * Per property validators where key is config name and value
- * is the validation function. This field is expected to be
- * overridden by extending classes.
- */
- configValidators: {},
-
- /**
- * Validate the given config property with the available
- *
- * @param config {App.ServiceConfigProperty}
- * @return {string} No validation issues when <code>null</code> returned.
- */
- validateConfig: function(config) {
- var validatorFunction = this.get('configValidators')[config.get('name')];
- if (validatorFunction) {
- return this[validatorFunction](config);
- }
- return null;
- },
-
- /**
- * Check if provided <code>config.value</code> is less than <code>recommendedDefaults</code>
- * @param {object} config - configProperty name
- * @return {string|null}
- */
- validatorLessThenDefaultValue: function(config) {
- var defaultValue = this.get('recommendedDefaults')[config.get('name')];
- var currentValue = parseInt(config.get('value').toString().replace( /\D+/g, ''));
- if (!defaultValue) {
- return null;
- }
- defaultValue = parseInt(defaultValue.toString().replace( /\D+/g, ''));
- if (defaultValue && currentValue && currentValue < defaultValue) {
- return "Value is less than the recommended default of " + defaultValue;
- }
- return null;
- },
-
- /**
- * Check if provided <code>config.value</code> is less than <code>recommendedDefaults</code> or <code>config.defaultValue</code>
- * Value looks like "-Xmx****m"
- * @param {object} config
- * @return {string|null}
- */
- validateXmxValue: function(config) {
- var recomendedDefault = this.get('recommendedDefaults')[config.get('name')];
- var defaultValueRaw = Em.isNone(recomendedDefault) ? config.get('defaultValue') : recomendedDefault;
- Em.assert('validateXmxValue: Config\'s default value can\'t be null or undefined', !Em.isNone(defaultValueRaw));
- var currentValueRaw = config.get('value');
- if (!this._checkXmxValueFormat(currentValueRaw)) {
- return 'Invalid value format';
- }
- var currentValue = this._formatXmxSizeToBytes(this._getXmxSize(currentValueRaw));
- var defaultValueXmx = this._getXmxSize(defaultValueRaw);
- var defaultValue = this._formatXmxSizeToBytes(defaultValueXmx);
- if (currentValue < defaultValue) {
- return "Value is less than the recommended default of -Xmx" + defaultValueXmx;
- }
- return null;
- },
- /**
- * Verify if provided value has proper format (should be like "-Xmx***(b|k|m|g|p|t|B|K|M|G|P|T)")
- * @param {string} value
- * @returns {bool}
- * @private
- */
- _checkXmxValueFormat: function(value) {
- var regex = /(^|\s)\-Xmx(\d+)(b|k|m|g|p|t|B|K|M|G|P|T)?(\s|$)/;
- if (!regex.test(value)) {
- return false;
- }
- // "-Xmx" can be only one
- return value.match(/\-Xmx/ig).length == 1;
- },
- /**
- * Parse Xmx size from raw value
- * @param {string} value
- * @returns {string}
- * @private
- */
- _getXmxSize: function(value) {
- var regex = /\-Xmx(\d+)(.?)/;
- var result = regex.exec(value);
- if (result.length > 1) {
- // result[2] - is a space or size formatter (b|k|m|g etc)
- return result[1] + result[2].toLowerCase();
- }
- return result[1];
- },
- /**
- * Calculate bytes size from value
- * @param {string} value
- * @returns {int}
- * @private
- */
- _formatXmxSizeToBytes: function(value) {
- value = value.toLowerCase();
- if (value.length == 0) {
- return 0;
- }
- var modifier = value[value.length - 1];
- if (modifier == ' ' || "0123456789".indexOf(modifier) != -1) {
- modifier = 'b';
- }
- var m = 1;
- switch (modifier) {
- case 'b': m = 1; break;
- case 'k': m = 1024; break;
- case 'm': m = 1024 * 1024; break;
- case 'g': m = 1024 * 1024 * 1024; break;
- case 't': m = 1024 * 1024 * 1024 * 1024; break;
- case 'p': m = 1024 * 1024 * 1024 * 1024 * 1024; break;
- }
- var result = parseInt(value.replace(modifier, '').trim());
- result *= m;
- return result;
- }
-
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/ab48cfbf/ambari-web/app/utils/configs/validators/storm_configs_validator.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/validators/storm_configs_validator.js b/ambari-web/app/utils/configs/validators/storm_configs_validator.js
deleted file mode 100644
index a2470f5..0000000
--- a/ambari-web/app/utils/configs/validators/storm_configs_validator.js
+++ /dev/null
@@ -1,42 +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('utils/configs/validators/service_configs_validator');
-
-App.STORMConfigsValidator = App.ServiceConfigsValidator.create({
- /**
- * List of the configs that should be validated
- */
- configValidators: {
- 'drpc.childopts': 'drpcChildOpts',
- 'ui.childopts': 'uiChildOpts',
- 'logviewer.childopts': 'logviewerChildOpts'
- },
-
- drpcChildOpts: function(config) {
- return this.validateXmxValue(config);
- },
-
- uiChildOpts: function(config) {
- return this.validateXmxValue(config);
- },
-
- logviewerChildOpts: function(config) {
- return this.validateXmxValue(config);
- }
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/ab48cfbf/ambari-web/app/utils/configs/validators/tez_configs_validator.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/validators/tez_configs_validator.js b/ambari-web/app/utils/configs/validators/tez_configs_validator.js
deleted file mode 100644
index 788ee60..0000000
--- a/ambari-web/app/utils/configs/validators/tez_configs_validator.js
+++ /dev/null
@@ -1,38 +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('utils/configs/validators/service_configs_validator');
-
-App.TezConfigsValidator = App.ServiceConfigsValidator.create({
- /**
- * List of the configs that should be validated
- */
- configValidators: {
- 'tez.am.resource.memory.mb': 'tezAMResourceMb',
- 'tez.am.java.opts': 'tezAMJavaOpts'
- },
-
- tezAMResourceMb: function(config) {
- return this.validatorLessThenDefaultValue(config);
- },
-
- tezAMJavaOpts: function(config) {
- return this.validateXmxValue(config);
- }
-
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/ab48cfbf/ambari-web/app/utils/configs/validators/user_configs_validator.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/validators/user_configs_validator.js b/ambari-web/app/utils/configs/validators/user_configs_validator.js
deleted file mode 100644
index 51afdf4..0000000
--- a/ambari-web/app/utils/configs/validators/user_configs_validator.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');
-var validator = require('utils/validator');
-require('utils/configs/validators/service_configs_validator');
-
-App.userConfigsValidator = App.ServiceConfigsValidator.create({
- /**
- * List of the configs that should be validated
- */
- configValidators: {
- 'hdfs_user': 'validateUserValue',
- 'mapred_user': 'validateUserValue',
- 'yarn_user': 'validateUserValue',
- 'hbase_user': 'validateUserValue',
- 'hive_user': 'validateUserValue',
- 'hcat_user': 'validateUserValue',
- 'webhcat_user': 'validateUserValue',
- 'oozie_user': 'validateUserValue',
- 'falcon_user': 'validateUserValue',
- 'storm_user': 'validateUserValue',
- 'zk_user': 'validateUserValue',
- 'gmetad_user': 'validateUserValue',
- 'gmond_user': 'validateUserValue',
- 'nagios_user': 'validateUserValue',
- 'smokeuser': 'validateUserValue'
- },
-
- validateUserValue: function(config) {
- var recomendedDefault = this.get('recommendedDefaults')[config.get('name')];
- var defaultValue = Em.isNone(recomendedDefault) ? config.get('defaultValue') : recomendedDefault;
- Em.assert('validateUserValue: User\'s default value can\'t be null or undefined', !Em.isNone(defaultValue));
- var currentValue = config.get('value');
- if (!validator.isValidUserName(currentValue)) {
- return Em.I18n.t('users.userName.validationFail');
- }
- return null;
- }
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/ab48cfbf/ambari-web/app/utils/configs/validators/yarn_configs_validator.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/configs/validators/yarn_configs_validator.js b/ambari-web/app/utils/configs/validators/yarn_configs_validator.js
deleted file mode 100644
index a51bd7c..0000000
--- a/ambari-web/app/utils/configs/validators/yarn_configs_validator.js
+++ /dev/null
@@ -1,43 +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('utils/configs/validators/service_configs_validator');
-
-App.YARNConfigsValidator = App.ServiceConfigsValidator.create({
- /**
- * List of the configs that should be validated
- */
- configValidators: {
- 'yarn.nodemanager.resource.memory-mb': 'yarnNodemanagerResourceMemoryMb',
- 'yarn.scheduler.minimum-allocation-mb': 'yarnSchedulerMinimumAllocationMb',
- 'yarn.scheduler.maximum-allocation-mb': 'yarnSchedulerMaximumAllocationMb'
- },
-
- yarnNodemanagerResourceMemoryMb: function(config) {
- return this.validatorLessThenDefaultValue(config);
- },
-
- yarnSchedulerMinimumAllocationMb: function(config) {
- return this.validatorLessThenDefaultValue(config);
- },
-
- yarnSchedulerMaximumAllocationMb: function(config) {
- return this.validatorLessThenDefaultValue(config);
- }
-
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/ab48cfbf/ambari-web/test/controllers/main/service/info/config_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/info/config_test.js b/ambari-web/test/controllers/main/service/info/config_test.js
index fd1d1dd..7a2fc79 100644
--- a/ambari-web/test/controllers/main/service/info/config_test.js
+++ b/ambari-web/test/controllers/main/service/info/config_test.js
@@ -1338,13 +1338,11 @@ describe("App.MainServiceInfoConfigsController", function () {
}];
beforeEach(function() {
sinon.stub(mainServiceInfoConfigsController, "setValueForCheckBox", Em.K);
- sinon.stub(mainServiceInfoConfigsController, "setValidator", Em.K);
sinon.stub(mainServiceInfoConfigsController, "setValuesForOverrides", Em.K);
sinon.stub(mainServiceInfoConfigsController, "setEditability", Em.K);
});
afterEach(function() {
mainServiceInfoConfigsController.setValueForCheckBox.restore();
- mainServiceInfoConfigsController.setValidator.restore();
mainServiceInfoConfigsController.setValuesForOverrides.restore();
mainServiceInfoConfigsController.setEditability.restore();
});
@@ -1352,9 +1350,7 @@ describe("App.MainServiceInfoConfigsController", function () {
it("create service config. run methods to correctly set object fileds", function() {
var result = mainServiceInfoConfigsController.createConfigProperty(t._serviceConfigProperty, t.defaultGroupSelected, t.restartData, t.serviceConfigsData);
expect(mainServiceInfoConfigsController.setValueForCheckBox.calledWith(t.serviceConfigProperty));
- expect(mainServiceInfoConfigsController.setValidator.calledWith(t.serviceConfigProperty, t.serviceConfigsData));
expect(mainServiceInfoConfigsController.setValuesForOverrides.calledWith(t._serviceConfigProperty.overrides, t._serviceConfigProperty, t.serviceConfigProperty, t.defaultGroupSelected));
- expect(mainServiceInfoConfigsController.setValidator.calledWith(t.serviceConfigProperty, t.defaultGroupSelected));
expect(result.getProperties('overrides','isOverridable')).to.eql(t.serviceConfigProperty);
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/ab48cfbf/ambari-web/test/models/stack_service_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/stack_service_test.js b/ambari-web/test/models/stack_service_test.js
index 3500343..efab9e0 100644
--- a/ambari-web/test/models/stack_service_test.js
+++ b/ambari-web/test/models/stack_service_test.js
@@ -236,32 +236,6 @@ describe('App.StackService', function () {
});
});
- describe('#defaultsProviders', function () {
- it('service name is HDFS', function () {
- ss.set('serviceName', 'HDFS');
- ss.propertyDidChange('defaultsProviders');
- expect(ss.get('defaultsProviders')).to.be.undefined;
- });
- it('service name is HIVE', function () {
- ss.set('serviceName', 'HIVE');
- ss.propertyDidChange('defaultsProviders');
- expect(ss.get('defaultsProviders')).to.not.be.empty;
- });
- });
-
- describe('#configsValidator', function () {
- it('service name is HDFS', function () {
- ss.set('serviceName', 'HDFS');
- ss.propertyDidChange('configsValidator');
- expect(ss.get('configsValidator')).to.be.undefined;
- });
- it('service name is HIVE', function () {
- ss.set('serviceName', 'HIVE');
- ss.propertyDidChange('configsValidator');
- expect(ss.get('configsValidator')).to.not.be.empty;
- });
- });
-
describe('#configCategories', function () {
it('HDFS service with no serviceComponents', function () {
ss.set('serviceComponents', []);
http://git-wip-us.apache.org/repos/asf/ambari/blob/ab48cfbf/ambari-web/test/utils/configs/defaults_providers/hive_defaults_provider_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/configs/defaults_providers/hive_defaults_provider_test.js b/ambari-web/test/utils/configs/defaults_providers/hive_defaults_provider_test.js
deleted file mode 100644
index e7009f4..0000000
--- a/ambari-web/test/utils/configs/defaults_providers/hive_defaults_provider_test.js
+++ /dev/null
@@ -1,162 +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('utils/configs/defaults_providers/defaultsProvider');
-require('utils/configs/defaults_providers/yarn_defaults_provider');
-
-describe('HiveDefaultsProvider', function() {
-
- describe('#getDefaults', function() {
- var tests = Em.A([
- {
- localDB: {},
- m: 'Empty localDB',
- e: null
- },
- {
- localDB: {
- "masterComponentHosts": []
- },
- m: 'localDB without hosts',
- e: null
- },
- {
- localDB: {
- "hosts": {}
- },
- m: 'localDB without masterComponentHosts amd slaveComponentHosts',
- e: null
- },
- {
- localDB: {
- "hosts": {
- "host1": {"name": "host1","cpu": 8,"memory": "25165824.00","disk_info": [{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'}]},
- "host2": {"name": "host2","cpu": 4,"memory": "25165824.00","disk_info": [{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'}]}
- },
- "masterComponentHosts": [],
- "slaveComponentHosts": [
- {
- "componentName": "NODEMANAGER",
- "hosts": [{"hostName": "host2"}]
- }
- ]
- },
- m: 'Without HBase',
- e: {
- 'mapreduce.map.java.opts': '-Xmx2048m',
- 'mapreduce.map.memory.mb': 2560,
- 'mapreduce.reduce.java.opts': '-Xmx2048m',
- 'mapreduce.reduce.memory.mb': 2560,
- 'yarn.app.mapreduce.am.command-opts': '-Xmx2048m',
- 'yarn.app.mapreduce.am.resource.mb': 2560,
- 'yarn.nodemanager.resource.memory-mb': 20480,
- 'yarn.scheduler.maximum-allocation-mb': 20480,
- 'yarn.scheduler.minimum-allocation-mb': 2560,
- 'mapreduce.task.io.sort.mb': 1024,
- 'hive.tez.container.size': 2560,
- 'hive.auto.convert.join.noconditionaltask.size': 894435328,
- 'hive.tez.java.opts': '-server -Xmx2048m -Djava.net.preferIPv4Stack=true -XX:NewRatio=8 -XX:+UseNUMA -XX:+UseParallelGC'
- }
- },
- {
- localDB: {
- "hosts": {
- "host1": {"name": "host1","cpu": 8,"memory": "25165824.00","disk_info": [{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'}]},
- "host2": {"name": "host2","cpu": 4,"memory": "12582912.00","disk_info": [{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'}]}
- },
- "masterComponentHosts": [
- {"component": "HBASE_MASTER","hostName": "host1","serviceId": "HDFS"}
- ],
- "slaveComponentHosts": [
- {
- "componentName": "NODEMANAGER",
- "hosts": [{"hostName": "host2"}]
- }
- ]
- },
- m: 'With HBase (low memory - pick mapreduce.reduce.memory.mb)',
- e: {
- 'mapreduce.map.java.opts': '-Xmx819m',
- 'mapreduce.map.memory.mb': 1024,
- 'mapreduce.reduce.java.opts': '-Xmx819m',
- 'mapreduce.reduce.memory.mb': 1024,
- 'yarn.app.mapreduce.am.command-opts': '-Xmx819m',
- 'yarn.app.mapreduce.am.resource.mb': 1024,
- 'yarn.nodemanager.resource.memory-mb': 8192,
- 'yarn.scheduler.maximum-allocation-mb': 8192,
- 'yarn.scheduler.minimum-allocation-mb': 1024,
- 'mapreduce.task.io.sort.mb': 410,
- 'hive.tez.container.size': 1024,
- 'hive.auto.convert.join.noconditionaltask.size': 357564416,
- 'hive.tez.java.opts': '-server -Xmx819m -Djava.net.preferIPv4Stack=true -XX:NewRatio=8 -XX:+UseNUMA -XX:+UseParallelGC'
- }
- },
- {
- localDB: {
- "hosts": {
- "host1": {"name": "host1","cpu": 8,"memory": "100165824.00","disk_info": [{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'}]},
- "host2": {"name": "host2","cpu": 4,"memory": "100165824.00","disk_info": [{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'}]}
- },
- "masterComponentHosts": [
- {"component": "HBASE_MASTER","hostName": "host1","serviceId": "HDFS"}
- ],
- "slaveComponentHosts": [
- {
- "componentName": "NODEMANAGER",
- "hosts": [{"hostName": "host2"}]
- }
- ]
- },
- m: 'With HBase (high memory - pick mapreduce.map.memory.mb)',
- e: {
- 'mapreduce.map.java.opts': '-Xmx6963m',
- 'mapreduce.map.memory.mb': 8704,
- 'mapreduce.reduce.java.opts': '-Xmx6963m',
- 'mapreduce.reduce.memory.mb': 8704,
- 'yarn.app.mapreduce.am.command-opts': '-Xmx6963m',
- 'yarn.app.mapreduce.am.resource.mb': 8704,
- 'yarn.nodemanager.resource.memory-mb': 69632,
- 'yarn.scheduler.maximum-allocation-mb': 69632,
- 'yarn.scheduler.minimum-allocation-mb': 8704,
- 'mapreduce.task.io.sort.mb': 1024,
- 'hive.tez.container.size': 8704,
- 'hive.auto.convert.join.noconditionaltask.size': 3041918976,
- 'hive.tez.java.opts': '-server -Xmx6963m -Djava.net.preferIPv4Stack=true -XX:NewRatio=8 -XX:+UseNUMA -XX:+UseParallelGC'
- }
- }
- ]);
- tests.forEach(function(test) {
- describe(test.m, function() {
- var defaultsProvider = App.HiveDefaultsProvider.create();
- defaultsProvider.set('clusterData', null);
- var configs = defaultsProvider.getDefaults(test.localDB);
- Em.keys(configs).forEach(function(config) {
- it(config, function() {
- if (test.e) {
- expect(configs[config]).to.equal(test.e[config]);
- }
- else {
- expect(configs[config] == 0 || configs[config] == null).to.equal(true);
- }
- })
- });
- });
- });
- });
-
-});
http://git-wip-us.apache.org/repos/asf/ambari/blob/ab48cfbf/ambari-web/test/utils/configs/defaults_providers/tez_defaults_provider_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/configs/defaults_providers/tez_defaults_provider_test.js b/ambari-web/test/utils/configs/defaults_providers/tez_defaults_provider_test.js
deleted file mode 100644
index 548d19c..0000000
--- a/ambari-web/test/utils/configs/defaults_providers/tez_defaults_provider_test.js
+++ /dev/null
@@ -1,126 +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('utils/configs/defaults_providers/defaultsProvider');
-require('utils/configs/defaults_providers/yarn_defaults_provider');
-
-describe('TezDefaultsProvider', function() {
-
- describe('#getDefaults', function() {
- var tests = [
- {
- localDB: {},
- m: 'Empty localDB',
- e: null
- },
- {
- localDB: {
- "masterComponentHosts": []
- },
- m: 'localDB without hosts',
- e: null
- },
- {
- localDB: {
- "hosts": {}
- },
- m: 'localDB without masterComponentHosts amd slaveComponentHosts',
- e: null
- },
- {
- localDB: {
- "hosts": {
- "host1": {"name": "host1","cpu": 8,"memory": "25165824.00","disk_info": [{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'}]},
- "host2": {"name": "host2","cpu": 4,"memory": "25165824.00","disk_info": [{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'}]}
- },
- "masterComponentHosts": [],
- "slaveComponentHosts": [
- {
- "componentName": "NODEMANAGER",
- "hosts": [{"hostName": "host2"}]
- }
- ]
- },
- m: 'Without HBase',
- e: {
- 'mapreduce.map.java.opts': '-Xmx2048m',
- 'mapreduce.map.memory.mb': 2560,
- 'mapreduce.reduce.java.opts': '-Xmx2048m',
- 'mapreduce.reduce.memory.mb': 2560,
- 'yarn.app.mapreduce.am.command-opts': '-Xmx2048m',
- 'yarn.app.mapreduce.am.resource.mb': 2560,
- 'yarn.nodemanager.resource.memory-mb': 20480,
- 'yarn.scheduler.maximum-allocation-mb': 20480,
- 'yarn.scheduler.minimum-allocation-mb': 2560,
- 'mapreduce.task.io.sort.mb': 1024,
- 'tez.am.resource.memory.mb': 2560,
- 'tez.am.java.opts': '-server -Xmx2048m -Djava.net.preferIPv4Stack=true -XX:+UseNUMA -XX:+UseParallelGC'
- }
- },
- {
- localDB: {
- "hosts": {
- "host1": {"name": "host1","cpu": 8,"memory": "25165824.00","disk_info": [{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'}]},
- "host2": {"name": "host2","cpu": 4,"memory": "12582912.00","disk_info": [{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'},{mountpoint:'/'}]}
- },
- "masterComponentHosts": [
- {"component": "HBASE_MASTER","hostName": "host1","serviceId": "HDFS"}
- ],
- "slaveComponentHosts": [
- {
- "componentName": "NODEMANAGER",
- "hosts": [{"hostName": "host2"}]
- }
- ]
- },
- m: 'With HBase',
- e: {
- 'mapreduce.map.java.opts': '-Xmx819m',
- 'mapreduce.map.memory.mb': 1024,
- 'mapreduce.reduce.java.opts': '-Xmx819m',
- 'mapreduce.reduce.memory.mb': 1024,
- 'yarn.app.mapreduce.am.command-opts': '-Xmx819m',
- 'yarn.app.mapreduce.am.resource.mb': 1024,
- 'yarn.nodemanager.resource.memory-mb': 8192,
- 'yarn.scheduler.maximum-allocation-mb': 8192,
- 'yarn.scheduler.minimum-allocation-mb': 1024,
- 'mapreduce.task.io.sort.mb': 410,
- 'tez.am.resource.memory.mb': 1024,
- 'tez.am.java.opts': '-server -Xmx819m -Djava.net.preferIPv4Stack=true -XX:+UseNUMA -XX:+UseParallelGC'
- }
- }
- ];
- tests.forEach(function(test) {
- describe(test.m, function() {
- var defaultsProvider = App.TezDefaultsProvider.create();
- defaultsProvider.set('clusterData', null);
- var configs = defaultsProvider.getDefaults(test.localDB);
- Em.keys(configs).forEach(function(config) {
- it(config, function() {
- if (test.e) {
- expect(configs[config]).to.equal(test.e[config]);
- } else {
- expect(configs[config] == 0 || configs[config] == null).to.equal(true);
- }
- });
- });
- });
- });
- });
-
-});