ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject ambari git commit: AMBARI-12695 Webhcat server fails to start (dsen)
Date Mon, 10 Aug 2015 17:27:24 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 649703e17 -> 78003bb56


AMBARI-12695 Webhcat server fails to start (dsen)


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

Branch: refs/heads/branch-2.1
Commit: 78003bb56b2401b10fa8e010b7cc21d63e431915
Parents: 649703e
Author: Dmytro Sen <dsen@apache.org>
Authored: Mon Aug 10 20:24:55 2015 +0300
Committer: Dmytro Sen <dsen@apache.org>
Committed: Mon Aug 10 20:27:15 2015 +0300

----------------------------------------------------------------------
 .../package/scripts/webhcat_service.py           | 15 +++++++++++++++
 .../stacks/2.0.6/HIVE/test_webhcat_server.py     | 19 +++++++++++++++++++
 2 files changed, 34 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/78003bb5/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/webhcat_service.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/webhcat_service.py
b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/webhcat_service.py
index 2b89ed1..46ad109 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/webhcat_service.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/webhcat_service.py
@@ -55,6 +55,21 @@ def webhcat_service(action='start', rolling_restart=False):
     Execute(daemon_cmd,
             user = params.webhcat_user,
             environment = environ)
+
+    pid_expression = "`" + as_user(format("cat {webhcat_pid_file}"), user=params.webhcat_user)
+ "`"
+    process_id_exists_command = format("ls {webhcat_pid_file} >/dev/null 2>&1 &&
ps -p {pid_expression} >/dev/null 2>&1")
+    daemon_hard_kill_cmd = format("{sudo} kill -9 {pid_expression}")
+    wait_time = 10
+    Execute(daemon_hard_kill_cmd,
+            not_if = format("! ({process_id_exists_command}) || ( sleep {wait_time} &&
! ({process_id_exists_command}) )")
+    )
+
+    # check if stopped the process, else fail the task
+    Execute(format("! ({process_id_exists_command})"),
+            tries=20,
+            try_sleep=3,
+    )
+
     File(params.webhcat_pid_file,
          action="delete",
     )

http://git-wip-us.apache.org/repos/asf/ambari/blob/78003bb5/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_webhcat_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_webhcat_server.py b/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_webhcat_server.py
index 1ccb39e..d558fcc 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_webhcat_server.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_webhcat_server.py
@@ -68,6 +68,16 @@ class TestWebHCatServer(RMFTestCase):
                               user = 'hcat',
                               environment = {'HADOOP_HOME': '/usr' }
                               )
+
+    self.assertResourceCalled('Execute', 'ambari-sudo.sh kill -9 `ambari-sudo.sh su hcat
-l -s /bin/bash -c \'[RMF_EXPORT_PLACEHOLDER]cat /var/run/webhcat/webhcat.pid\'`',
+                              not_if = "! (ls /var/run/webhcat/webhcat.pid >/dev/null
2>&1 && ps -p `ambari-sudo.sh su hcat -l -s /bin/bash -c '[RMF_EXPORT_PLACEHOLDER]cat
/var/run/webhcat/webhcat.pid'` >/dev/null 2>&1) || ( sleep 10 && ! (ls /var/run/webhcat/webhcat.pid
>/dev/null 2>&1 && ps -p `ambari-sudo.sh su hcat -l -s /bin/bash -c '[RMF_EXPORT_PLACEHOLDER]cat
/var/run/webhcat/webhcat.pid'` >/dev/null 2>&1) )"
+    )
+
+    self.assertResourceCalled('Execute', "! (ls /var/run/webhcat/webhcat.pid >/dev/null
2>&1 && ps -p `ambari-sudo.sh su hcat -l -s /bin/bash -c '[RMF_EXPORT_PLACEHOLDER]cat
/var/run/webhcat/webhcat.pid'` >/dev/null 2>&1)",
+                              tries=20,
+                              try_sleep=3,
+    )
+
     self.assertResourceCalled('File', '/var/run/webhcat/webhcat.pid',
         action = ['delete'],
     )
@@ -115,6 +125,15 @@ class TestWebHCatServer(RMFTestCase):
                               user = 'hcat',
                               environment = {'HADOOP_HOME': '/usr' }
                               )
+
+    self.assertResourceCalled('Execute', 'ambari-sudo.sh kill -9 `ambari-sudo.sh su hcat
-l -s /bin/bash -c \'[RMF_EXPORT_PLACEHOLDER]cat /var/run/webhcat/webhcat.pid\'`',
+                              not_if = "! (ls /var/run/webhcat/webhcat.pid >/dev/null
2>&1 && ps -p `ambari-sudo.sh su hcat -l -s /bin/bash -c '[RMF_EXPORT_PLACEHOLDER]cat
/var/run/webhcat/webhcat.pid'` >/dev/null 2>&1) || ( sleep 10 && ! (ls /var/run/webhcat/webhcat.pid
>/dev/null 2>&1 && ps -p `ambari-sudo.sh su hcat -l -s /bin/bash -c '[RMF_EXPORT_PLACEHOLDER]cat
/var/run/webhcat/webhcat.pid'` >/dev/null 2>&1) )"
+    )
+
+    self.assertResourceCalled('Execute', "! (ls /var/run/webhcat/webhcat.pid >/dev/null
2>&1 && ps -p `ambari-sudo.sh su hcat -l -s /bin/bash -c '[RMF_EXPORT_PLACEHOLDER]cat
/var/run/webhcat/webhcat.pid'` >/dev/null 2>&1)",
+                              tries=20,
+                              try_sleep=3,
+    )
     self.assertResourceCalled('File', '/var/run/webhcat/webhcat.pid',
         action = ['delete'],
     )


Mime
View raw message