ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dmitriu...@apache.org
Subject ambari git commit: AMBARI-10561. Improve YARN service check (dlysnichenko)
Date Fri, 17 Apr 2015 17:04:44 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 4bb98e46f -> ac7507975


AMBARI-10561. Improve YARN service check (dlysnichenko)


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

Branch: refs/heads/trunk
Commit: ac7507975ad450d2e39eb9459129f04fc1e5dbc8
Parents: 4bb98e4
Author: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Authored: Fri Apr 17 20:03:48 2015 +0300
Committer: Lisnichenko Dmitro <dlysnichenko@hortonworks.com>
Committed: Fri Apr 17 20:03:48 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, 13 insertions(+), 40 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ac750797/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 2eef667..547c687 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,6 +19,7 @@ Ambari Agent
 
 """
 
+from resource_management.libraries.functions.version import compare_versions
 from resource_management import *
 import sys
 from ambari_commons import OSConst
@@ -78,29 +79,19 @@ class ServiceCheckDefault(ServiceCheck):
     import params
     env.set_params(params)
 
-    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
+    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"
     else:
-      component_address = params.rm_webui_address
+      path_to_distributed_shell_jar = "/usr/lib/hadoop-yarn/hadoop-yarn-applications-distributedshell*.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}")
+    yarn_distrubuted_shell_check_cmd = format("yarn org.apache.hadoop.yarn.applications.distributedshell.Client
"
+            "-shell_command ls -jar {path_to_distributed_shell_jar}")
 
     if params.security_enabled:
       kinit_cmd = format("{kinit_path_local} -kt {smoke_user_keytab} {smokeuser_principal};")
-      smoke_cmd = format("{kinit_cmd} {validateStatusCmd}")
+      smoke_cmd = format("{kinit_cmd} {yarn_distrubuted_shell_check_cmd}")
     else:
-      smoke_cmd = validateStatusCmd
-
-    File(validateStatusFilePath,
-         content=StaticFile(validateStatusFileName),
-         mode=0755
-    )
+      smoke_cmd = yarn_distrubuted_shell_check_cmd
 
     Execute(smoke_cmd,
             tries=3,
@@ -110,11 +101,6 @@ 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/ac750797/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 7cde2cc..1376fef 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,21 +36,14 @@ class TestServiceCheck(RMFTestCase):
                           hdp_stack_version = self.STACK_VERSION,
                           target = RMFTestCase.TARGET_COMMON_SERVICES
     )
-    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',
+    self.assertResourceCalled('Execute', 'yarn org.apache.hadoop.yarn.applications.distributedshell.Client
'
+                                         '-shell_command ls -jar /usr/lib/hadoop-yarn/hadoop-yarn-applications-distributedshell*.jar',
                           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):
@@ -61,19 +54,13 @@ class TestServiceCheck(RMFTestCase):
                           hdp_stack_version = self.STACK_VERSION,
                           target = RMFTestCase.TARGET_COMMON_SERVICES
     )
-    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
ambari-qa@EXAMPLE.COM; /usr/bin/python2.6 /tmp/validateYarnComponentStatus.py rm -p c6402.ambari.apache.org:8088
-s False',
+    self.assertResourceCalled('Execute', '/usr/bin/kinit -kt /etc/security/keytabs/smokeuser.headless.keytab
'
+                                         'ambari-qa@EXAMPLE.COM; yarn org.apache.hadoop.yarn.applications.distributedshell.Client
'
+                                         '-shell_command ls -jar /usr/lib/hadoop-yarn/hadoop-yarn-applications-distributedshell*.jar',
                           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()


Mime
View raw message