You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by vb...@apache.org on 2015/04/02 12:14:43 UTC
ambari git commit: AMBARI-10315. Add ability to manage some of
Mahaout configs(if needed).(vbrodetskyi)
Repository: ambari
Updated Branches:
refs/heads/trunk b119d1252 -> 7d118f7a1
AMBARI-10315. Add ability to manage some of Mahaout configs(if needed).(vbrodetskyi)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7d118f7a
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7d118f7a
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7d118f7a
Branch: refs/heads/trunk
Commit: 7d118f7a1c3a2ad0646c8044c4da7c56e7b16a72
Parents: b119d12
Author: Vitaly Brodetskyi <vb...@hortonworks.com>
Authored: Thu Apr 2 06:28:34 2015 +0300
Committer: Vitaly Brodetskyi <vb...@hortonworks.com>
Committed: Thu Apr 2 06:28:34 2015 +0300
----------------------------------------------------------------------
.../1.0.0.2.3/configuration/mahout-log4j.xml | 65 ++++++++++++++++++++
.../MAHOUT/1.0.0.2.3/metainfo.xml | 8 +++
.../MAHOUT/1.0.0.2.3/package/scripts/mahout.py | 14 ++++-
.../MAHOUT/1.0.0.2.3/package/scripts/params.py | 2 +
.../stacks/2.3/MAHOUT/test_mahout_client.py | 6 ++
.../test/python/stacks/2.3/configs/default.json | 3 +
6 files changed, 97 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/7d118f7a/ambari-server/src/main/resources/common-services/MAHOUT/1.0.0.2.3/configuration/mahout-log4j.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/MAHOUT/1.0.0.2.3/configuration/mahout-log4j.xml b/ambari-server/src/main/resources/common-services/MAHOUT/1.0.0.2.3/configuration/mahout-log4j.xml
new file mode 100644
index 0000000..c5ee937
--- /dev/null
+++ b/ambari-server/src/main/resources/common-services/MAHOUT/1.0.0.2.3/configuration/mahout-log4j.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
+<!--
+/**
+ * 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.
+ */
+-->
+
+<configuration supports_final="false">
+
+ <property>
+ <name>content</name>
+ <description>Custom log4j.properties</description>
+ <value>
+#
+#
+# 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.
+#
+#
+#
+
+# Set everything to be logged to the console
+log4j.rootCategory=WARN, console
+log4j.appender.console=org.apache.log4j.ConsoleAppender
+log4j.appender.console.target=System.err
+log4j.appender.console.layout=org.apache.log4j.PatternLayout
+log4j.appender.console.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{1}: %m%n
+
+# Settings to quiet third party logs that are too verbose
+log4j.logger.org.eclipse.jetty=WARN
+log4j.logger.org.apache.spark.repl.SparkIMain$exprTyper=WARN
+log4j.logger.org.apache.spark.repl.SparkILoop$SparkILoopInterpreter=WARN
+ </value>
+ </property>
+
+</configuration>
http://git-wip-us.apache.org/repos/asf/ambari/blob/7d118f7a/ambari-server/src/main/resources/common-services/MAHOUT/1.0.0.2.3/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/MAHOUT/1.0.0.2.3/metainfo.xml b/ambari-server/src/main/resources/common-services/MAHOUT/1.0.0.2.3/metainfo.xml
index 15ede51..73e2d3f 100644
--- a/ambari-server/src/main/resources/common-services/MAHOUT/1.0.0.2.3/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/MAHOUT/1.0.0.2.3/metainfo.xml
@@ -37,6 +37,13 @@
<scriptType>PYTHON</scriptType>
<timeout>1200</timeout>
</commandScript>
+ <configFiles>
+ <configFile>
+ <type>env</type>
+ <fileName>log4j.properties</fileName>
+ <dictionaryName>mahout-log4j</dictionaryName>
+ </configFile>
+ </configFiles>
</component>
</components>
<osSpecifics>
@@ -61,6 +68,7 @@
</requiredServices>
<configuration-dependencies>
+ <config-type>mahout-log4j</config-type>
</configuration-dependencies>
</service>
http://git-wip-us.apache.org/repos/asf/ambari/blob/7d118f7a/ambari-server/src/main/resources/common-services/MAHOUT/1.0.0.2.3/package/scripts/mahout.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/MAHOUT/1.0.0.2.3/package/scripts/mahout.py b/ambari-server/src/main/resources/common-services/MAHOUT/1.0.0.2.3/package/scripts/mahout.py
index ba10035..c9d2915 100644
--- a/ambari-server/src/main/resources/common-services/MAHOUT/1.0.0.2.3/package/scripts/mahout.py
+++ b/ambari-server/src/main/resources/common-services/MAHOUT/1.0.0.2.3/package/scripts/mahout.py
@@ -31,4 +31,16 @@ def mahout():
group = params.user_group
)
- # TODO add configs creation
+ if not is_empty(params.log4j_props):
+ File(format("{params.mahout_conf_dir}/log4j.properties"),
+ mode=0644,
+ group=params.user_group,
+ owner=params.mahout_user,
+ content=params.log4j_props
+ )
+ elif (os.path.exists(format("{params.mahout_conf_dir}/log4j.properties"))):
+ File(format("{params.mahout_conf_dir}/log4j.properties"),
+ mode=0644,
+ group=params.user_group,
+ owner=params.mahout_user
+ )
http://git-wip-us.apache.org/repos/asf/ambari/blob/7d118f7a/ambari-server/src/main/resources/common-services/MAHOUT/1.0.0.2.3/package/scripts/params.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/MAHOUT/1.0.0.2.3/package/scripts/params.py b/ambari-server/src/main/resources/common-services/MAHOUT/1.0.0.2.3/package/scripts/params.py
index 8efea99..874de56 100644
--- a/ambari-server/src/main/resources/common-services/MAHOUT/1.0.0.2.3/package/scripts/params.py
+++ b/ambari-server/src/main/resources/common-services/MAHOUT/1.0.0.2.3/package/scripts/params.py
@@ -57,6 +57,8 @@ kinit_path_local = functions.get_kinit_path()
# not supporting 32 bit jdk.
java64_home = config['hostLevelParams']['java_home']
+log4j_props = config['configurations']['mahout-log4j']['content']
+
import functools
#create partial functions with common arguments for every HdfsDirectory call
#to create hdfs directory we need to call params.HdfsDirectory in code
http://git-wip-us.apache.org/repos/asf/ambari/blob/7d118f7a/ambari-server/src/test/python/stacks/2.3/MAHOUT/test_mahout_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.3/MAHOUT/test_mahout_client.py b/ambari-server/src/test/python/stacks/2.3/MAHOUT/test_mahout_client.py
index b74c4e4..19a6fe6 100644
--- a/ambari-server/src/test/python/stacks/2.3/MAHOUT/test_mahout_client.py
+++ b/ambari-server/src/test/python/stacks/2.3/MAHOUT/test_mahout_client.py
@@ -39,5 +39,11 @@ class TestMahoutClient(RMFTestCase):
group = 'hadoop',
recursive = True,
)
+ self.assertResourceCalled('File', '/etc/mahout/conf/log4j.properties',
+ content = self.getConfig()['configurations']['mahout-log4j']['content'],
+ owner = 'mahout',
+ group = 'hadoop',
+ mode = 0644,
+ )
self.assertNoMoreResources()
http://git-wip-us.apache.org/repos/asf/ambari/blob/7d118f7a/ambari-server/src/test/python/stacks/2.3/configs/default.json
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.3/configs/default.json b/ambari-server/src/test/python/stacks/2.3/configs/default.json
index 37c69d5..3073a22 100644
--- a/ambari-server/src/test/python/stacks/2.3/configs/default.json
+++ b/ambari-server/src/test/python/stacks/2.3/configs/default.json
@@ -36,6 +36,9 @@
"mahout-env": {
"mahout_user": "mahout"
},
+ "mahout-log4j": {
+ "content": "\n #\n #\n # Licensed to the Apache Software Foundation (ASF) under one\n # or more contributor license agreements. See the NOTICE file\n # distributed with this work for additional information\n # regarding copyright ownership. The ASF licenses this file\n # to you under the Apache License, Version 2.0 (the\n # \"License\"); you may not use this file except in compliance\n # with the License. You may obtain a copy of the License at\n #\n # http://www.apache.org/licenses/LICENSE-2.0\n #\n # Unless required by applicable law or agreed to in writing,\n # software distributed under the License is distributed on an\n # \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n # KIND, either express or implied. See the License for the\n # specific language governing permiss
ions and limitations\n # under the License.\n #\n #\n #\n\n # Set everything to be logged to the console\n log4j.rootCategory=WARN, console\n log4j.appender.console=org.apache.log4j.ConsoleAppender\n log4j.appender.console.target=System.err\n log4j.appender.console.layout=org.apache.log4j.PatternLayout\n log4j.appender.console.layout.ConversionPattern=%d{yy/MM/dd HH:mm:ss} %p %c{1}: %m%n\n\n # Settings to quiet third party logs that are too verbose\n log4j.logger.org.eclipse.jetty=WARN\n log4j.logger.org.apache.spark.repl.SparkIMain$exprTyper=WARN\n log4j.logger.org.apache.spark.repl.SparkILoop$SparkILoopInterpreter=WARN"
+ },
"hadoop-env": {
"hdfs_user": "hdfs"
},