You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ds...@apache.org on 2015/09/29 20:00:57 UTC

ambari git commit: AMBARI-13269 Ambari map/reduce/AM java opts do not change if memory settings are modified (dsen)

Repository: ambari
Updated Branches:
  refs/heads/trunk d4edf4619 -> 50099dd40


AMBARI-13269 Ambari map/reduce/AM java opts do not change if memory settings are modified (dsen)


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

Branch: refs/heads/trunk
Commit: 50099dd40c72f07f55cbe60a0426f9e70e2102bb
Parents: d4edf46
Author: Dmytro Sen <ds...@apache.org>
Authored: Tue Sep 29 21:00:43 2015 +0300
Committer: Dmytro Sen <ds...@apache.org>
Committed: Tue Sep 29 21:00:43 2015 +0300

----------------------------------------------------------------------
 .../stacks/HDP/2.0.6/services/stack_advisor.py  | 11 +++++++--
 .../stacks/2.2/common/test_stack_advisor.py     | 24 +++++++++++++-------
 2 files changed, 25 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/50099dd4/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 8deff04..c4450b6 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
@@ -105,12 +105,19 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
     if"properties" not in config[configType]:
       config[configType]["properties"] = {}
     def appendProperty(key, value):
-      if {'type': configType, 'name': key} in changedConfigs:
+      # If property exists in changedConfigs, do not override, use user defined property
+      if self.__isPropertyInChangedConfigs(configType, key, changedConfigs):
         config[configType]["properties"][key] = userConfigs[configType]['properties'][key]
       else:
         config[configType]["properties"][key] = str(value)
     return appendProperty
 
+  def __isPropertyInChangedConfigs(self, configType, propertyName, changedConfigs):
+    for changedConfig in changedConfigs:
+      if changedConfig['type']==configType and changedConfig['name']==propertyName:
+        return True
+    return False
+
   def putPropertyAttribute(self, config, configType):
     if configType not in config:
       config[configType] = {}
@@ -1237,4 +1244,4 @@ def getMemorySizeRequired(components, configurations):
   return totalMemoryRequired
 
 def round_to_n(mem_size, n=128):
-  return int(round(mem_size / float(n))) * int(n)
\ No newline at end of file
+  return int(round(mem_size / float(n))) * int(n)

http://git-wip-us.apache.org/repos/asf/ambari/blob/50099dd4/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 054bf96..97cf4ca 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
@@ -837,15 +837,18 @@ class TestHDP22StackAdvisor(TestCase):
       "changed-configurations": [
         {
           "type": "yarn-site",
-          "name": "yarn.nodemanager.resource.memory-mb"
+          "name": "yarn.nodemanager.resource.memory-mb",
+          "old_value": "512"
         },
         {
           "type": "yarn-site",
-          "name": "yarn.scheduler.minimum-allocation-mb"
+          "name": "yarn.scheduler.minimum-allocation-mb",
+          "old_value": "512"
         },
         {
           "type": "yarn-site",
-          "name": "yarn.scheduler.maximum-allocation-mb"
+          "name": "yarn.scheduler.maximum-allocation-mb",
+          "old_value": "512"
         },
         {
           "type": "yarn-site",
@@ -926,7 +929,8 @@ class TestHDP22StackAdvisor(TestCase):
     configurations["yarn-site"]["properties"]["yarn.nodemanager.resource.percentage-physical-cpu-limit"] = '0.5'
     services["changed-configurations"].append({
           "type": "yarn-site",
-          "name": "yarn.nodemanager.resource.percentage-physical-cpu-limit"
+          "name": "yarn.nodemanager.resource.percentage-physical-cpu-limit",
+          "old_value": "6"
         })
     expected["yarn-site"]["properties"]["yarn.nodemanager.resource.cpu-vcores"] = '5'
     expected["yarn-site"]["properties"]["yarn.scheduler.minimum-allocation-vcores"] = '1'
@@ -1600,7 +1604,8 @@ class TestHDP22StackAdvisor(TestCase):
       "changed-configurations": [
         {
           "type": "yarn-site",
-          "name": "yarn.scheduler.minimum-allocation-mb"
+          "name": "yarn.scheduler.minimum-allocation-mb",
+          "old_value": "512"
         },
         ]
 
@@ -1836,7 +1841,8 @@ class TestHDP22StackAdvisor(TestCase):
       "changed-configurations": [
         {
           "type": "yarn-site",
-          "name": "yarn.scheduler.minimum-allocation-mb"
+          "name": "yarn.scheduler.minimum-allocation-mb",
+          "old_value": "512"
         },
       ]
 
@@ -2114,7 +2120,8 @@ class TestHDP22StackAdvisor(TestCase):
     services['changed-configurations'] = [
       {
         "type": "ams-hbase-env",
-        "name": "hbase_master_heapsize"
+        "name": "hbase_master_heapsize",
+        "old_value": "1024"
       }
     ]
 
@@ -2155,7 +2162,8 @@ class TestHDP22StackAdvisor(TestCase):
     services['changed-configurations'] = [
       {
         "type": "ams-hbase-env",
-        "name": "hbase_regionserver_heapsize"
+        "name": "hbase_regionserver_heapsize",
+        "old_value": "512"
       }
     ]
     services["configurations"]['ams-hbase-site']['properties']['hbase.rootdir'] = 'hdfs://host1/amshbase'