Repository: ambari Updated Branches: refs/heads/trunk ac7507975 -> 4254fb4a1
Revert "AMBARI-10561. Improve YARN service check (dlysnichenko)" This reverts commit ac7507975ad450d2e39eb9459129f04fc1e5dbc8. Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/85aa856b Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/85aa856b Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/85aa856b Branch: refs/heads/trunk Commit: 85aa856ba232ebd9836914b54585773c7a3d7d30 Parents: ac75079 Author: Lisnichenko Dmitro <[email protected]> Authored: Fri Apr 17 20:05:24 2015 +0300 Committer: Lisnichenko Dmitro <[email protected]> Committed: Fri Apr 17 20:05:24 2015 +0300 ---------------------------------------------------------------------- .../2.1.0.2.0/package/scripts/service_check.py | 30 ++++++++++++++------ .../2.0.6/YARN/test_yarn_service_check.py | 23 +++++++++++---- 2 files changed, 40 insertions(+), 13 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/85aa856b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/service_check.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/service_check.py b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/service_check.py index 547c687..2eef667 100644 --- a/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/service_check.py +++ b/ambari-server/src/main/resources/common-services/YARN/2.1.0.2.0/package/scripts/service_check.py @@ -19,7 +19,6 @@ Ambari Agent """ -from resource_management.libraries.functions.version import compare_versions from resource_management import * import sys from ambari_commons import OSConst @@ -79,19 +78,29 @@ class ServiceCheckDefault(ServiceCheck): import params env.set_params(params) - if params.hdp_stack_version != "" and compare_versions(params.hdp_stack_version, '2.2') >= 0: - path_to_distributed_shell_jar = "/usr/hdp/current/hadoop-yarn-client/hadoop-yarn-applications-distributedshell.jar" + run_yarn_check_cmd = format("yarn --config {hadoop_conf_dir} node -list") + + component_type = 'rm' + if params.hadoop_ssl_enabled: + component_address = params.rm_webui_https_address else: - path_to_distributed_shell_jar = "/usr/lib/hadoop-yarn/hadoop-yarn-applications-distributedshell*.jar" + component_address = params.rm_webui_address - yarn_distrubuted_shell_check_cmd = format("yarn org.apache.hadoop.yarn.applications.distributedshell.Client " - "-shell_command ls -jar {path_to_distributed_shell_jar}") + validateStatusFileName = "validateYarnComponentStatus.py" + validateStatusFilePath = format("{tmp_dir}/{validateStatusFileName}") + python_executable = sys.executable + validateStatusCmd = format("{python_executable} {validateStatusFilePath} {component_type} -p {component_address} -s {hadoop_ssl_enabled}") if params.security_enabled: kinit_cmd = format("{kinit_path_local} -kt {smoke_user_keytab} {smokeuser_principal};") - smoke_cmd = format("{kinit_cmd} {yarn_distrubuted_shell_check_cmd}") + smoke_cmd = format("{kinit_cmd} {validateStatusCmd}") else: - smoke_cmd = yarn_distrubuted_shell_check_cmd + smoke_cmd = validateStatusCmd + + File(validateStatusFilePath, + content=StaticFile(validateStatusFileName), + mode=0755 + ) Execute(smoke_cmd, tries=3, @@ -101,6 +110,11 @@ class ServiceCheckDefault(ServiceCheck): logoutput=True ) + Execute(run_yarn_check_cmd, + path=params.execute_path, + user=params.smokeuser + ) + if __name__ == "__main__": ServiceCheck().execute() http://git-wip-us.apache.org/repos/asf/ambari/blob/85aa856b/ambari-server/src/test/python/stacks/2.0.6/YARN/test_yarn_service_check.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.0.6/YARN/test_yarn_service_check.py b/ambari-server/src/test/python/stacks/2.0.6/YARN/test_yarn_service_check.py index 1376fef..7cde2cc 100644 --- a/ambari-server/src/test/python/stacks/2.0.6/YARN/test_yarn_service_check.py +++ b/ambari-server/src/test/python/stacks/2.0.6/YARN/test_yarn_service_check.py @@ -36,14 +36,21 @@ class TestServiceCheck(RMFTestCase): hdp_stack_version = self.STACK_VERSION, target = RMFTestCase.TARGET_COMMON_SERVICES ) - self.assertResourceCalled('Execute', 'yarn org.apache.hadoop.yarn.applications.distributedshell.Client ' - '-shell_command ls -jar /usr/lib/hadoop-yarn/hadoop-yarn-applications-distributedshell*.jar', + self.assertResourceCalled('File', '/tmp/validateYarnComponentStatus.py', + content = StaticFile('validateYarnComponentStatus.py'), + mode = 0755, + ) + self.assertResourceCalled('Execute', '/usr/bin/python2.6 /tmp/validateYarnComponentStatus.py rm -p c6402.ambari.apache.org:8088 -s False', logoutput = True, path = ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'], tries = 3, user = 'ambari-qa', try_sleep = 5, ) + self.assertResourceCalled('Execute', 'yarn --config /etc/hadoop/conf node -list', + path = ["/bin:/usr/bin:/usr/lib/hadoop-yarn/bin"], + user = 'ambari-qa', + ) self.assertNoMoreResources() def test_service_check_secured(self): @@ -54,13 +61,19 @@ class TestServiceCheck(RMFTestCase): hdp_stack_version = self.STACK_VERSION, target = RMFTestCase.TARGET_COMMON_SERVICES ) - self.assertResourceCalled('Execute', '/usr/bin/kinit -kt /etc/security/keytabs/smokeuser.headless.keytab ' - '[email protected]; yarn org.apache.hadoop.yarn.applications.distributedshell.Client ' - '-shell_command ls -jar /usr/lib/hadoop-yarn/hadoop-yarn-applications-distributedshell*.jar', + self.assertResourceCalled('File', '/tmp/validateYarnComponentStatus.py', + content = StaticFile('validateYarnComponentStatus.py'), + mode = 0755, + ) + self.assertResourceCalled('Execute', '/usr/bin/kinit -kt /etc/security/keytabs/smokeuser.headless.keytab [email protected]; /usr/bin/python2.6 /tmp/validateYarnComponentStatus.py rm -p c6402.ambari.apache.org:8088 -s False', logoutput = True, path = ['/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin'], tries = 3, user = 'ambari-qa', try_sleep = 5, ) + self.assertResourceCalled('Execute', 'yarn --config /etc/hadoop/conf node -list', + path = ["/bin:/usr/bin:/usr/lib/hadoop-yarn/bin"], + user = 'ambari-qa', + ) self.assertNoMoreResources()
