You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by at...@apache.org on 2014/11/02 21:22:57 UTC
git commit: AMBARI-8109 Fix Tez configuration section on Ambari UI.
(Buzhor Denys via atkach)
Repository: ambari
Updated Branches:
refs/heads/trunk 7cea66b6e -> ec9462989
AMBARI-8109 Fix Tez configuration section on Ambari UI. (Buzhor Denys via atkach)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ec946298
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ec946298
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ec946298
Branch: refs/heads/trunk
Commit: ec94629891bb4592593f9060b496629d6f2aaa64
Parents: 7cea66b
Author: atkach <at...@hortonworks.com>
Authored: Sun Nov 2 22:22:37 2014 +0200
Committer: atkach <at...@hortonworks.com>
Committed: Sun Nov 2 22:22:37 2014 +0200
----------------------------------------------------------------------
ambari-web/app/data/HDP2.2/site_properties.js | 14 ++-
ambari-web/app/data/HDP2.2/tez_properties.js | 43 ++++++++++
ambari-web/app/utils/config.js | 39 ++++++++-
ambari-web/test/utils/config_test.js | 99 ++++++++++++++++++++++
4 files changed, 191 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/ec946298/ambari-web/app/data/HDP2.2/site_properties.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/HDP2.2/site_properties.js b/ambari-web/app/data/HDP2.2/site_properties.js
index 5b49100..979d16a 100644
--- a/ambari-web/app/data/HDP2.2/site_properties.js
+++ b/ambari-web/app/data/HDP2.2/site_properties.js
@@ -18,6 +18,7 @@
var App = require('app');
+var tezProperties = require('data/HDP2.2/tez_properties');
var hdp2properties = require('data/HDP2/site_properties').configProperties;
var excludedConfigs = [
'storm.thrift.transport', //In HDP2.2 storm.thrift.transport property is computed on server
@@ -31,7 +32,7 @@ var excludedConfigs = [
'tez.runtime.intermediate-input.is-compressed',
'tez.runtime.intermediate-output.compress.codec',
'tez.runtime.intermediate-output.should-compress',
- 'dfs.datanode.data.dir' //this property is overridden with different properties
+ 'dfs.datanode.data.dir'
];
var hdp22properties = hdp2properties.filter(function (item) {
return !excludedConfigs.contains(item.name);
@@ -79,7 +80,16 @@ hdp22properties.push(
"index": 1
});
+var additionalProperties = [];
+
+tezProperties.forEach(function(config) {
+ if (!hdp22properties.findProperty('name', config.name)) additionalProperties.push(config);
+ else {
+ hdp22properties.findProperty('name', config.name).category = config.category;
+ }
+});
+
module.exports =
{
- "configProperties": hdp22properties
+ "configProperties": hdp22properties.concat(additionalProperties)
};
http://git-wip-us.apache.org/repos/asf/ambari/blob/ec946298/ambari-web/app/data/HDP2.2/tez_properties.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/data/HDP2.2/tez_properties.js b/ambari-web/app/data/HDP2.2/tez_properties.js
new file mode 100644
index 0000000..46f18ba
--- /dev/null
+++ b/ambari-web/app/data/HDP2.2/tez_properties.js
@@ -0,0 +1,43 @@
+/**
+ * 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 tezPropsToCategory = {
+ 'General': [
+ 'tez.am.launch.cmd-opts',
+ 'tez.am.launch.env',
+ 'tez.task.resource.memory.mb',
+ 'tez.task.launch.cmd-opts',
+ 'tez.task.launch.env',
+ 'tez.grouping.split-waves',
+ 'tez.grouping.min-size',
+ 'tez.grouping.max-size',
+ 'tez.runtime.compress',
+ 'tez.runtime.compress.codec'
+ ]
+};
+
+var tezProps = [];
+
+for (var category in tezPropsToCategory) {
+ tezProps = tezProps.concat(App.config.generateConfigPropertiesByName(tezPropsToCategory[category],
+ { category: category, serviceName: 'TEZ', filename: 'tez-site.xml'}));
+}
+
+module.exports = tezProps;
+
http://git-wip-us.apache.org/repos/asf/ambari/blob/ec946298/ambari-web/app/utils/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index a934cae..2f157e8 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -1662,8 +1662,43 @@ App.config = Em.Object.create({
* @param hostName
* (string) host name used to register
*/
- getConfigGroupsForHost: function (hostName) {
+ getConfigGroupsForHost: function (hostName) {
- }
+ },
+ /**
+ * Generate minimal config property object used in *_properties.js files.
+ * Example:
+ * <code>
+ * var someProperties = App.config.generateConfigPropertiesByName([
+ * 'property_1', 'property_2', 'property_3'], { category: 'General', filename: 'myFileName'});
+ * // someProperties contains Object[]
+ * [
+ * {
+ * name: 'property_1',
+ * displayName: 'property_1',
+ * isVisible: true,
+ * isReconfigurable: true,
+ * category: 'General',
+ * filename: 'myFileName'
+ * },
+ * .......
+ * ]
+ * </code>
+ * @param {Array} names
+ * @param {Object} properties - additional properties which will merge with base object definition
+ * @returns {*}
+ */
+ generateConfigPropertiesByName: function(names, properties) {
+ return names.map(function (item) {
+ var baseObj = {
+ name: item,
+ displayName: item,
+ isVisible: true,
+ isReconfigurable: true
+ };
+ if (properties) return $.extend(baseObj, properties);
+ else return baseObj;
+ });
+ }
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/ec946298/ambari-web/test/utils/config_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/config_test.js b/ambari-web/test/utils/config_test.js
index 25b454f..5dec0ae 100644
--- a/ambari-web/test/utils/config_test.js
+++ b/ambari-web/test/utils/config_test.js
@@ -477,6 +477,105 @@ describe('App.config', function () {
});
});
+ describe('#generateConfigPropertiesByName', function() {
+ var tests = [
+ {
+ names: ['property_1', 'property_2'],
+ properties: undefined,
+ e: {
+ keys: ['name', 'displayName', 'isVisible', 'isReconfigurable']
+ },
+ m: 'Should generate base property object without additional fields'
+ },
+ {
+ names: ['property_1', 'property_2'],
+ properties: { category: 'SomeCat', serviceName: 'SERVICE_NAME' },
+ e: {
+ keys: ['name', 'displayName', 'isVisible', 'isReconfigurable', 'category', 'serviceName']
+ },
+ m: 'Should generate base property object without additional fields'
+ }
+ ];
+
+ tests.forEach(function(test) {
+ it(test.m, function() {
+ expect(App.config.generateConfigPropertiesByName(test.names, test.properties).length).to.eql(test.names.length);
+ expect(App.config.generateConfigPropertiesByName(test.names, test.properties).map(function(property) {
+ return Em.keys(property);
+ }).reduce(function(p, c) {
+ return p.concat(c);
+ }).uniq()).to.eql(test.e.keys);
+ });
+ });
+
+ });
+
+ describe('#generateConfigPropertiesByName', function() {
+ var tests = [
+ {
+ names: ['property_1', 'property_2'],
+ properties: undefined,
+ e: {
+ keys: ['name', 'displayName', 'isVisible', 'isReconfigurable']
+ },
+ m: 'Should generate base property object without additional fields'
+ },
+ {
+ names: ['property_1', 'property_2'],
+ properties: { category: 'SomeCat', serviceName: 'SERVICE_NAME' },
+ e: {
+ keys: ['name', 'displayName', 'isVisible', 'isReconfigurable', 'category', 'serviceName']
+ },
+ m: 'Should generate base property object without additional fields'
+ }
+ ];
+
+ tests.forEach(function(test) {
+ it(test.m, function() {
+ expect(App.config.generateConfigPropertiesByName(test.names, test.properties).length).to.eql(test.names.length);
+ expect(App.config.generateConfigPropertiesByName(test.names, test.properties).map(function(property) {
+ return Em.keys(property);
+ }).reduce(function(p, c) {
+ return p.concat(c);
+ }).uniq()).to.eql(test.e.keys);
+ });
+ });
+
+ });
+
+ describe('#generateConfigPropertiesByName', function() {
+ var tests = [
+ {
+ names: ['property_1', 'property_2'],
+ properties: undefined,
+ e: {
+ keys: ['name', 'displayName', 'isVisible', 'isReconfigurable']
+ },
+ m: 'Should generate base property object without additional fields'
+ },
+ {
+ names: ['property_1', 'property_2'],
+ properties: { category: 'SomeCat', serviceName: 'SERVICE_NAME' },
+ e: {
+ keys: ['name', 'displayName', 'isVisible', 'isReconfigurable', 'category', 'serviceName']
+ },
+ m: 'Should generate base property object without additional fields'
+ }
+ ];
+
+ tests.forEach(function(test) {
+ it(test.m, function() {
+ expect(App.config.generateConfigPropertiesByName(test.names, test.properties).length).to.eql(test.names.length);
+ expect(App.config.generateConfigPropertiesByName(test.names, test.properties).map(function(property) {
+ return Em.keys(property);
+ }).reduce(function(p, c) {
+ return p.concat(c);
+ }).uniq()).to.eql(test.e.keys);
+ });
+ });
+
+ });
+
describe('#isManagedMySQLForHiveAllowed', function () {
var cases = [