You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jl...@apache.org on 2016/03/24 20:03:44 UTC

ambari git commit: AMBARI-15137: Stack Featurize TEZ service (Juanjo Marron via jluniya)

Repository: ambari
Updated Branches:
  refs/heads/trunk eb7e8b2dd -> 706bc29c3


AMBARI-15137: Stack Featurize TEZ service (Juanjo Marron via jluniya)


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

Branch: refs/heads/trunk
Commit: 706bc29c3dce7fe79738f31c1272b85481c18de3
Parents: eb7e8b2
Author: Jayush Luniya <jl...@hortonworks.com>
Authored: Thu Mar 24 12:03:37 2016 -0700
Committer: Jayush Luniya <jl...@hortonworks.com>
Committed: Thu Mar 24 12:03:37 2016 -0700

----------------------------------------------------------------------
 .../TEZ/0.4.0.2.1/package/scripts/params_linux.py   | 16 ++++++++++------
 .../TEZ/0.4.0.2.1/package/scripts/pre_upgrade.py    |  5 +++--
 .../TEZ/0.4.0.2.1/package/scripts/service_check.py  |  5 +++--
 .../TEZ/0.4.0.2.1/package/scripts/tez_client.py     |  8 +++++---
 4 files changed, 21 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/706bc29c/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/params_linux.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/params_linux.py
index 0165c0b..944244a 100644
--- a/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/params_linux.py
+++ b/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/params_linux.py
@@ -22,6 +22,8 @@ import os
 from resource_management.libraries.resources import HdfsResource
 from resource_management.libraries.functions import conf_select
 from resource_management.libraries.functions import stack_select
+from resource_management.libraries.functions import StackFeature
+from resource_management.libraries.functions.stack_features import check_stack_feature
 from resource_management.libraries.functions.version import format_stack_version
 from resource_management.libraries.functions.default import default
 from resource_management.libraries.functions import get_kinit_path
@@ -33,6 +35,7 @@ config = Script.get_config()
 tmp_dir = Script.get_tmp_dir()
 
 stack_name = default("/hostLevelParams/stack_name", None)
+stack_root = Script.get_stack_root()
 
 # This is expected to be of the form #.#.#.#
 stack_version_unformatted = str(config['hostLevelParams']['stack_version'])
@@ -49,15 +52,16 @@ tez_etc_dir = "/etc/tez"
 config_dir = "/etc/tez/conf"
 tez_examples_jar = "/usr/lib/tez/tez-mapreduce-examples*.jar"
 
-# hadoop parameters for 2.2+
-if Script.is_stack_greater_or_equal("2.2"):
-  tez_examples_jar = "/usr/hdp/current/tez-client/tez-examples*.jar"
+# hadoop parameters for stacks that support rolling_upgrade
+if stack_version_formatted and check_stack_feature(StackFeature.ROLLING_UPGRADE, stack_version_formatted):
+  tez_examples_jar = "{stack_root}/current/tez-client/tez-examples*.jar"
 
-# tez only started linking <stack-root>/x.x.x.x/tez-client/conf in HDP 2.3+
-if Script.is_stack_greater_or_equal("2.3"):
+# tez only started linking <stack-root>/x.x.x.x/tez-client/conf in config_versioning
+if stack_version_formatted and check_stack_feature(StackFeature.CONFIG_VERSIONING, stack_version_formatted):
   # !!! use realpath for now since the symlink exists but is broken and a
   # broken symlink messes with the DirectoryProvider class
-  config_dir = os.path.realpath("/usr/hdp/current/tez-client/conf")
+  config_path = os.path.join(stack_root, "current/tez-client/conf")
+  config_dir = os.path.realpath(config_path)
 
 kinit_path_local = get_kinit_path(default('/configurations/kerberos-env/executable_search_paths', None))
 security_enabled = config['configurations']['cluster-env']['security_enabled']

http://git-wip-us.apache.org/repos/asf/ambari/blob/706bc29c/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/pre_upgrade.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/pre_upgrade.py b/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/pre_upgrade.py
index 1faedf9..9d5868b 100644
--- a/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/pre_upgrade.py
+++ b/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/pre_upgrade.py
@@ -20,7 +20,8 @@ Ambari Agent
 """
 
 from resource_management.libraries.script import Script
-from resource_management.libraries.functions.version import compare_versions
+from resource_management.libraries.functions import StackFeature
+from resource_management.libraries.functions.stack_features import check_stack_feature
 from resource_management.libraries.functions.copy_tarball import copy_to_hdfs
 from resource_management.core.exceptions import Fail
 
@@ -38,7 +39,7 @@ class TezPreUpgrade(Script):
 
     Logger.info("Before starting Stack Upgrade, check if tez tarball has been copied to HDFS.")
 
-    if params.stack_version_formatted and compare_versions(params.stack_version_formatted, '2.2.0.0') >= 0:
+    if params.stack_version_formatted and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.stack_version_formatted):
       Logger.info("Stack version {0} is sufficient to check if need to copy tez.tar.gz to HDFS.".format(params.stack_version_formatted))
 
       # Force it to copy the current version of the tez tarball, rather than the version the RU will go to.

http://git-wip-us.apache.org/repos/asf/ambari/blob/706bc29c/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/service_check.py b/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/service_check.py
index c0c66af..af429f6 100644
--- a/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/service_check.py
+++ b/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/service_check.py
@@ -23,7 +23,8 @@ from resource_management.libraries.script import Script
 from resource_management.libraries.resources.hdfs_resource import HdfsResource
 from resource_management.libraries.resources.execute_hadoop import ExecuteHadoop
 from resource_management.libraries.functions import format
-from resource_management.libraries.functions.version import compare_versions
+from resource_management.libraries.functions import StackFeature
+from resource_management.libraries.functions.stack_features import check_stack_feature
 from resource_management.libraries.functions.copy_tarball import copy_to_hdfs
 from resource_management.core.resources.system import File, Execute
 
@@ -67,7 +68,7 @@ class TezServiceCheckLinux(TezServiceCheck):
       source = format("{tmp_dir}/sample-tez-test"),
     )
 
-    if params.stack_version_formatted and compare_versions(params.stack_version_formatted, '2.2.0.0') >= 0:
+    if params.stack_version_formatted and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.stack_version_formatted):
       copy_to_hdfs("tez", params.user_group, params.hdfs_user, host_sys_prepped=params.host_sys_prepped)
 
     params.HdfsResource(None, action = "execute")

http://git-wip-us.apache.org/repos/asf/ambari/blob/706bc29c/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/tez_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/tez_client.py b/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/tez_client.py
index e770d9b..ca13c6e 100644
--- a/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/tez_client.py
+++ b/ambari-server/src/main/resources/common-services/TEZ/0.4.0.2.1/package/scripts/tez_client.py
@@ -30,8 +30,9 @@ from resource_management.core.exceptions import ClientComponentHasNoStatus
 from resource_management.core.source import InlineTemplate
 from resource_management.libraries.functions import conf_select
 from resource_management.libraries.functions import stack_select
+from resource_management.libraries.functions import StackFeature
+from resource_management.libraries.functions.stack_features import check_stack_feature
 from resource_management.libraries.functions.get_stack_version import get_stack_version
-from resource_management.libraries.functions.version import compare_versions, format_stack_version
 from resource_management.libraries.script.script import Script
 
 from tez import tez
@@ -49,13 +50,14 @@ class TezClient(Script):
 class TezClientLinux(TezClient):
 
   def get_stack_to_component(self):
-    return {"HDP": "hadoop-client"}
+    import params
+    return {params.stack_name : "hadoop-client"}
 
   def pre_upgrade_restart(self, env, upgrade_type=None):
     import params
     env.set_params(params)
 
-    if params.version and compare_versions(format_stack_version(params.version), '2.2.0.0') >= 0:
+    if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version):
       conf_select.select(params.stack_name, "tez", params.version)
       conf_select.select(params.stack_name, "hadoop", params.version)
       stack_select.select("hadoop-client", params.version)