You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ao...@apache.org on 2014/11/07 19:07:02 UTC

[2/2] ambari git commit: AMBARI-8209. Configs: YARN settings (aonishuk)

AMBARI-8209. Configs: YARN settings (aonishuk)


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

Branch: refs/heads/branch-1.7.0
Commit: 1ad1ad6567a209ebc530df435b0050a1aa8366b9
Parents: 7120a2f
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Fri Nov 7 20:06:54 2014 +0200
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Fri Nov 7 20:06:54 2014 +0200

----------------------------------------------------------------------
 .../stacks/HDP/2.0.6/services/stack_advisor.py  |  3 ++-
 .../services/YARN/configuration/yarn-site.xml   |  2 +-
 .../stacks/HDP/2.2/services/stack_advisor.py    |  7 ++++++-
 .../stacks/2.2/common/test_stack_advisor.py     | 21 ++++++++++++++++++++
 4 files changed, 30 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1ad1ad65/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
index ccbaeb3..9115fb3 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/stack_advisor.py
@@ -85,7 +85,8 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
     }
 
   def putProperty(self, config, configType):
-    config[configType] = {"properties": {}}
+    if configType not in config or "properties" not in config[configType]:
+      config[configType] = {"properties": {}}
     def appendProperty(key, value):
       config[configType]["properties"][key] = str(value)
     return appendProperty

http://git-wip-us.apache.org/repos/asf/ambari/blob/1ad1ad65/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/configuration/yarn-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/configuration/yarn-site.xml b/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/configuration/yarn-site.xml
index 18c6e9a..b4f6558 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/configuration/yarn-site.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/YARN/configuration/yarn-site.xml
@@ -233,7 +233,7 @@
   </property>
   <property>
     <name>yarn.timeline-service.ttl-enable</name>
-    <value>1</value>
+    <value>true</value>
     <description></description>
   </property>
   <property>

http://git-wip-us.apache.org/repos/asf/ambari/blob/1ad1ad65/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
index aa25bba..ac0d75d 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.2/services/stack_advisor.py
@@ -24,11 +24,16 @@ class HDP22StackAdvisor(HDP21StackAdvisor):
     childRecommendConfDict = {
       "HDFS": self.recommendHDFSConfigurations,
       "MAPREDUCE2": self.recommendMapReduce2Configurations,
-      "TEZ": self.recommendTezConfigurations
+      "TEZ": self.recommendTezConfigurations,
+      "YARN": self.recommendYARNConfigurations
     }
     parentRecommendConfDict.update(childRecommendConfDict)
     return parentRecommendConfDict
 
+  def recommendYARNConfigurations(self, configurations, clusterData):
+    super(HDP22StackAdvisor, self).recommendYARNConfigurations(configurations, clusterData)
+    putYarnProperty = self.putProperty(configurations, "yarn-site")
+    putYarnProperty('yarn.nodemanager.resource.cpu-vcores', clusterData['cpu'])
 
   def recommendHDFSConfigurations(self, configurations, clusterData):
     putHdfsPropery = self.putProperty(configurations, "hdfs-site")

http://git-wip-us.apache.org/repos/asf/ambari/blob/1ad1ad65/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py
index c5c31ee..2ba6d0d 100644
--- a/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.2/common/test_stack_advisor.py
@@ -479,3 +479,24 @@ class TestHDP22StackAdvisor(TestCase):
     expected = []  # No warnings
     validation_problems = self.stackAdvisor.validateHDFSConfigurations(properties, recommendedDefaults, configurations)
     self.assertEquals(validation_problems, expected)
+
+  def test_recommendYARNConfigurations(self):
+    configurations = {}
+    clusterData = {
+      "cpu": 4,
+      "containers" : 5,
+      "ramPerContainer": 256
+    }
+    expected = {
+      "yarn-site": {
+        "properties": {
+          "yarn.nodemanager.resource.memory-mb": "1280",
+          "yarn.scheduler.minimum-allocation-mb": "256",
+          "yarn.scheduler.maximum-allocation-mb": "1280",
+          "yarn.nodemanager.resource.cpu-vcores": "4"
+        }
+      }
+    }
+
+    self.stackAdvisor.recommendYARNConfigurations(configurations, clusterData)
+    self.assertEquals(configurations, expected)