You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sm...@apache.org on 2017/01/29 16:43:50 UTC
ambari git commit: AMBARI-19764. yarn.min.container.size is read
incorrectly on first load of the Hive config page (smohanty)
Repository: ambari
Updated Branches:
refs/heads/branch-2.5 30c2c3bf1 -> 0f6fe1dfc
AMBARI-19764. yarn.min.container.size is read incorrectly on first load of the Hive config page (smohanty)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0f6fe1df
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0f6fe1df
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0f6fe1df
Branch: refs/heads/branch-2.5
Commit: 0f6fe1dfc1c273d3afe9a8a627e28258d80ec7ce
Parents: 30c2c3b
Author: Sumit Mohanty <sm...@hortonworks.com>
Authored: Sat Jan 28 10:42:27 2017 -0800
Committer: Sumit Mohanty <sm...@hortonworks.com>
Committed: Sun Jan 29 08:43:30 2017 -0800
----------------------------------------------------------------------
.../stacks/HDP/2.0.6/services/stack_advisor.py | 30 +++-
.../stacks/2.0.6/common/test_stack_advisor.py | 148 +++++++++++++++++++
2 files changed, 174 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/0f6fe1df/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 c750acf..7cf4345 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
@@ -1045,15 +1045,25 @@ class HDP206StackAdvisor(DefaultStackAdvisor):
callContext = getCallContext(services)
operation = getUserOperationContext(services, DefaultStackAdvisor.OPERATION)
+ adding_yarn = isServiceBeingAdded(services, 'YARN')
if operation:
Logger.info("user operation context : " + str(operation))
if services: # its never None but some unit tests pass it as None
# If min container value is changed (user is changing it)
- # if its a validation call - just used what ever value is set
- # If its not a cluster create or add yarn service (TBD)
- if (getOldValue(self, services, "yarn-site", "yarn.scheduler.minimum-allocation-mb") or \
- 'recommendConfigurations' != callContext) and operation != DefaultStackAdvisor.CLUSTER_CREATE_OPERATION:
+ # if its a validation call - just use what ever value is set
+ # If its a recommend attribute call (when UI lands on a page)
+ # If add service but YARN is not being added
+ if getOldValue(self, services, "yarn-site", "yarn.scheduler.minimum-allocation-mb") or \
+ 'recommendConfigurations' != callContext or \
+ operation == DefaultStackAdvisor.RECOMMEND_ATTRIBUTE_OPERATION or \
+ (operation == DefaultStackAdvisor.ADD_SERVICE_OPERATION and not adding_yarn):
+
+ Logger.info("Full context: callContext = " + str(callContext) +
+ " and operation = " + str(operation) + " and adding YARN = " + str(adding_yarn) +
+ " and old value exists = " +
+ str(getOldValue(self, services, "yarn-site", "yarn.scheduler.minimum-allocation-mb")))
+
'''yarn.scheduler.minimum-allocation-mb has changed - then pick this value up'''
if "yarn-site" in services["configurations"] and \
"yarn.scheduler.minimum-allocation-mb" in services["configurations"]["yarn-site"]["properties"] and \
@@ -2067,6 +2077,18 @@ def getUserOperationContext(services, contextName):
return userContext[contextName]
return None
+# if serviceName is being added
+def isServiceBeingAdded(services, serviceName):
+ if services:
+ if 'user-context' in services.keys():
+ userContext = services["user-context"]
+ if DefaultStackAdvisor.OPERATION in userContext and \
+ 'AddService' == userContext[DefaultStackAdvisor.OPERATION] and \
+ DefaultStackAdvisor.OPERATION_DETAILS in userContext:
+ if -1 != userContext["operation_details"].find(serviceName):
+ return True
+ return False
+
# Validation helper methods
def getSiteProperties(configurations, siteName):
siteConfig = configurations.get(siteName)
http://git-wip-us.apache.org/repos/asf/ambari/blob/0f6fe1df/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py b/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
index 606b855..157a582 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/common/test_stack_advisor.py
@@ -596,6 +596,154 @@ class TestHDP206StackAdvisor(TestCase):
result = self.stackAdvisor.getConfigurationClusterSummary(servicesList, hosts, components, services)
self.assertEquals(result, expected_2048)
+ # Recommend attribute call - pick user specified value
+ services = {"services":
+ [{"StackServices":
+ {"service_name": "YARN",
+ "service_version": "2.6.0.2.2"
+ },
+ "components": [
+ {
+ "StackServiceComponents": {
+ "advertise_version": "true",
+ "cardinality": "1+",
+ "component_category": "SLAVE",
+ "component_name": "NODEMANAGER",
+ "custom_commands": [
+
+ ],
+ "display_name": "NodeManager",
+ "is_client": "false",
+ "is_master": "false",
+ "service_name": "YARN",
+ "stack_name": "HDP",
+ "stack_version": "2.2",
+ "hostnames": [
+ "host1"
+ ]
+ },
+ "dependencies": [
+ ]
+ }
+ ],
+ }],
+ "configurations": {
+ "yarn-site": {
+ "properties": {
+ "yarn.scheduler.minimum-allocation-mb": "2048",
+ "yarn.scheduler.maximum-allocation-mb": "12288"
+ }
+ }
+ },
+ "changed-configurations": [],
+ "user-context" : {
+ "operation" : "RecommendAttribute"
+ },
+ "advisor_context": {'call_type': 'recommendConfigurations'}
+ }
+
+ result = self.stackAdvisor.getConfigurationClusterSummary(servicesList, hosts, components, services)
+ self.assertEquals(result, expected_2048)
+
+ # Add service and not adding YARN - pick user specified value
+ services = {"services":
+ [{"StackServices":
+ {"service_name": "YARN",
+ "service_version": "2.6.0.2.2"
+ },
+ "components": [
+ {
+ "StackServiceComponents": {
+ "advertise_version": "true",
+ "cardinality": "1+",
+ "component_category": "SLAVE",
+ "component_name": "NODEMANAGER",
+ "custom_commands": [
+
+ ],
+ "display_name": "NodeManager",
+ "is_client": "false",
+ "is_master": "false",
+ "service_name": "YARN",
+ "stack_name": "HDP",
+ "stack_version": "2.2",
+ "hostnames": [
+ "host1"
+ ]
+ },
+ "dependencies": [
+ ]
+ }
+ ],
+ }],
+ "configurations": {
+ "yarn-site": {
+ "properties": {
+ "yarn.scheduler.minimum-allocation-mb": "2048",
+ "yarn.scheduler.maximum-allocation-mb": "12288"
+ }
+ }
+ },
+ "changed-configurations": [],
+ "user-context" : {
+ "operation" : "AddService",
+ "operation_details" : "TEZ,HIVE,SLIDER"
+ },
+ "advisor_context": {'call_type': 'recommendConfigurations'}
+ }
+
+ result = self.stackAdvisor.getConfigurationClusterSummary(servicesList, hosts, components, services)
+ self.assertEquals(result, expected_2048)
+
+ # Add service and adding YARN - compute the value
+ services = {"services":
+ [{"StackServices":
+ {"service_name": "YARN",
+ "service_version": "2.6.0.2.2"
+ },
+ "components": [
+ {
+ "StackServiceComponents": {
+ "advertise_version": "true",
+ "cardinality": "1+",
+ "component_category": "SLAVE",
+ "component_name": "NODEMANAGER",
+ "custom_commands": [
+
+ ],
+ "display_name": "NodeManager",
+ "is_client": "false",
+ "is_master": "false",
+ "service_name": "YARN",
+ "stack_name": "HDP",
+ "stack_version": "2.2",
+ "hostnames": [
+ "host1"
+ ]
+ },
+ "dependencies": [
+ ]
+ }
+ ],
+ }],
+ "configurations": {
+ "yarn-site": {
+ "properties": {
+ "yarn.scheduler.minimum-allocation-mb": "512"
+ }
+ }
+ },
+ "changed-configurations": [],
+ "user-context" : {
+ "operation" : "AddService",
+ "operation_details" : "TEZ,HIVE,YARN,SLIDER"
+ },
+ "advisor_context": {'call_type': 'recommendConfigurations'}
+ }
+
+ result = self.stackAdvisor.getConfigurationClusterSummary(servicesList, hosts, components, services)
+ self.assertEquals(result, expected)
+
# Recommend config dependencies call - pick user specified value
services = {"services":
[{"StackServices":