ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rle...@apache.org
Subject [4/8] ambari git commit: AMBARI-21237. Add validation and recommendation if hive user value is different than hive.(vbrodetskyi)
Date Thu, 15 Jun 2017 14:20:18 GMT
AMBARI-21237. Add validation and recommendation if hive user value is different than hive.(vbrodetskyi)


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

Branch: refs/heads/branch-feature-AMBARI-20859
Commit: 874b1f8334ba214b4be1eb4ad7394e5ce6abdd73
Parents: a06b6e1
Author: Vitaly Brodetskyi <vbrodetskyi@hortonworks.com>
Authored: Thu Jun 15 14:15:34 2017 +0300
Committer: Vitaly Brodetskyi <vbrodetskyi@hortonworks.com>
Committed: Thu Jun 15 14:15:34 2017 +0300

----------------------------------------------------------------------
 .../services/YARN/configuration/yarn-site.xml   |  6 ++++
 .../stacks/HDP/2.6/services/stack_advisor.py    | 36 ++++++++++++++++++--
 2 files changed, 40 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/874b1f83/ambari-server/src/main/resources/stacks/HDP/2.6/services/YARN/configuration/yarn-site.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/YARN/configuration/yarn-site.xml
b/ambari-server/src/main/resources/stacks/HDP/2.6/services/YARN/configuration/yarn-site.xml
index cab0e65..5f8de49 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/YARN/configuration/yarn-site.xml
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/YARN/configuration/yarn-site.xml
@@ -109,6 +109,12 @@
   <property>
     <name>yarn.nodemanager.kill-escape.user</name>
     <value>hive</value>
+    <depends-on>
+      <property>
+        <type>hive-env</type>
+        <name>hive_user</name>
+      </property>
+    </depends-on>
     <on-ambari-upgrade add="false"/>
   </property>
 </configuration>

http://git-wip-us.apache.org/repos/asf/ambari/blob/874b1f83/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py b/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py
index 488562b..f8bbca5 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.6/services/stack_advisor.py
@@ -180,6 +180,26 @@ class HDP26StackAdvisor(HDP25StackAdvisor):
     super(HDP26StackAdvisor, self).recommendYARNConfigurations(configurations, clusterData,
services, hosts)
     putYarnSiteProperty = self.putProperty(configurations, "yarn-site", services)
     putYarnEnvProperty = self.putProperty(configurations, "yarn-env", services)
+    servicesList = [service["StackServices"]["service_name"] for service in services["services"]]
+
+    if 'HIVE' in servicesList and "yarn-site" in services["configurations"] and "yarn.nodemanager.kill-escape.user"
in \
+                services["configurations"]["yarn-site"]["properties"] and 'hive-env' in services['configurations']
and \
+                'hive_user' in services['configurations']['hive-env']['properties']:
+      hive_user_name = services['configurations']['hive-env']['properties']['hive_user']
+      old_hive_user_name = getOldValue(self, services, "hive-env", "hive_user")
+      yarn_nm_kill_escape_user = services["configurations"]["yarn-site"]["properties"]["yarn.nodemanager.kill-escape.user"]
+      if not hive_user_name in yarn_nm_kill_escape_user:
+        if not yarn_nm_kill_escape_user or yarn_nm_kill_escape_user.strip() == "":
+          yarn_nm_kill_escape_user = hive_user_name
+        else:
+          escape_user_names = yarn_nm_kill_escape_user.split(",")
+          if old_hive_user_name in escape_user_names:
+            escape_user_names.remove(old_hive_user_name)
+          escape_user_names.append(hive_user_name)
+          yarn_nm_kill_escape_user = ",".join(escape_user_names)
+
+        putYarnSiteProperty("yarn.nodemanager.kill-escape.user", yarn_nm_kill_escape_user)
+
 
     if "yarn-site" in services["configurations"] and \
                     "yarn.resourcemanager.scheduler.monitor.enable" in services["configurations"]["yarn-site"]["properties"]:
@@ -391,6 +411,18 @@ class HDP26StackAdvisor(HDP25StackAdvisor):
   def validateYarnSiteConfigurations(self, properties, recommendedDefaults, configurations,
services, hosts):
       validationItems = []
       siteProperties = services["configurations"]["yarn-site"]["properties"]
+      servicesList = [service["StackServices"]["service_name"] for service in services["services"]]
+
+      if 'HIVE' in servicesList and "yarn-site" in services["configurations"] and "yarn.nodemanager.kill-escape.user"
in \
+          services["configurations"]["yarn-site"]["properties"] and 'hive-env' in services['configurations']
and \
+                  'hive_user' in services['configurations']['hive-env']['properties']:
+        hive_user = services['configurations']['hive-env']['properties']['hive_user']
+        yarn_nm_kill_escape_user = services["configurations"]["yarn-site"]["properties"]["yarn.nodemanager.kill-escape.user"]
+        if not hive_user in yarn_nm_kill_escape_user:
+          validationItems.append(
+            {"config-name": "yarn.nodemanager.kill-escape.user",
+             "item": self.getWarnItem("Value should contain %s" % hive_user)})
+
       if services["configurations"]["yarn-site"]["properties"]["yarn.http.policy"] == 'HTTP_ONLY':
          webapp_address = services["configurations"]["yarn-site"]["properties"]["yarn.timeline-service.webapp.address"]
          propertyValue = "http://"+webapp_address+"/ws/v1/applicationhistory"
@@ -399,9 +431,9 @@ class HDP26StackAdvisor(HDP25StackAdvisor):
          propertyValue = "https://"+webapp_address+"/ws/v1/applicationhistory"
       self.logger.info("validateYarnSiteConfigurations: recommended value for webservice
url"+services["configurations"]["yarn-site"]["properties"]["yarn.log.server.web-service.url"])
       if services["configurations"]["yarn-site"]["properties"]["yarn.log.server.web-service.url"]
!= propertyValue:
-         validationItems = [
+         validationItems.append(
               {"config-name": "yarn.log.server.web-service.url",
-               "item": self.getWarnItem("Value should be %s" % propertyValue)}]
+               "item": self.getWarnItem("Value should be %s" % propertyValue)})
       return self.toConfigurationValidationProblems(validationItems, "yarn-site")
 
   def validateDruidHistoricalConfigurations(self, properties, recommendedDefaults, configurations,
services, hosts):


Mime
View raw message