AMBARI-15137: Parameterize distro-specific stack information for TEZ (Juanjo Marron via dili)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b68758b7 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b68758b7 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b68758b7 Branch: refs/heads/AMBARI-13364 Commit: b68758b7b95b6228ca21cec00c8c72d9b3d72217 Parents: fa8b4c4 Author: Di Li <d...@apache.org> Authored: Mon Feb 29 10:34:46 2016 -0500 Committer: Jayush Luniya <jlun...@hortonworks.com> Committed: Wed Mar 9 15:40:35 2016 -0800 ---------------------------------------------------------------------- .../TEZ/0.4.0.2.1/package/scripts/params_linux.py | 16 ++++++++++------ .../TEZ/0.4.0.2.1/package/scripts/pre_upgrade.py | 2 +- .../TEZ/0.4.0.2.1/package/scripts/service_check.py | 2 +- .../TEZ/0.4.0.2.1/package/scripts/tez_client.py | 5 +++-- .../stacks/HDP/2.0.6/configuration/cluster-env.xml | 5 +++++ 5 files changed, 20 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/b68758b7/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 cc87973..439f862 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 @@ -32,10 +32,13 @@ config = Script.get_config() tmp_dir = Script.get_tmp_dir() stack_name = default("/hostLevelParams/stack_name", None) +stack_dir = config['configurations']['cluster-env']['stack_dir'] # This is expected to be of the form #.#.#.# stack_version_unformatted = str(config['hostLevelParams']['stack_version']) stack_version_formatted = format_stack_version(stack_version_unformatted) +stack_version_ru_support = config['configurations']['cluster-env']['stack_version_ru_support'] +stack_version_tez_symlink_support = config['configurations']['cluster-env']['stack_version_tez_symlink_support'] # New Cluster Stack Version that is defined during the RESTART of a Rolling Upgrade version = default("/commandParams/version", None) @@ -48,15 +51,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 stack_version_ru_support+ +if Script.is_stack_greater_or_equal(stack_version_ru_support): + tez_examples_jar = "{stack_dir}/current/tez-client/tez-examples*.jar" -# tez only started linking /usr/hdp/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_dir>/x.x.x.x/tez-client/conf in stack_version_tez_symlink_support+ +if Script.is_stack_greater_or_equal(stack_version_tez_symlink_support): # !!! 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_dir, "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/b68758b7/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..68df679 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 @@ -38,7 +38,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 compare_versions(params.stack_version_formatted, params.stack_version_ru_support) >= 0: 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/b68758b7/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..e581d8b 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 @@ -67,7 +67,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 compare_versions(params.stack_version_formatted, params.stack_version_ru_support) >= 0: 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/b68758b7/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..dcd194d 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 @@ -49,13 +49,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 compare_versions(format_stack_version(params.version), params.stack_version_ru_support) >= 0: 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) http://git-wip-us.apache.org/repos/asf/ambari/blob/b68758b7/ambari-server/src/main/resources/stacks/HDP/2.0.6/configuration/cluster-env.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/configuration/cluster-env.xml b/ambari-server/src/main/resources/stacks/HDP/2.0.6/configuration/cluster-env.xml index 75b499f..3263457 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/configuration/cluster-env.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/configuration/cluster-env.xml @@ -72,6 +72,11 @@ <description>Stack version from which oozie-server special case in the PRE-UPGRADE phase is supported</description> </property> <property> + <name>stack_version_tez_symlink_support</name> + <value>2.3.0.0</value> + <description>Stack version from which tez-client symlink for configuration is supported</description> + </property> + <property> <name>security_enabled</name> <value>false</value> <description>Hadoop Security</description>