Repository: ambari Updated Branches: refs/heads/branch-2.4 a9c1e3a2e -> aa259ae44
AMBARI-17776. HiveServer interactive stop should wait for 30 second before sending hard kill command (ajit) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/aa259ae4 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/aa259ae4 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/aa259ae4 Branch: refs/heads/branch-2.4 Commit: aa259ae444c872bb2e783ef32f92e69d01334207 Parents: a9c1e3a Author: Ajit Kumar <[email protected]> Authored: Mon Jul 18 16:14:26 2016 -0700 Committer: Ajit Kumar <[email protected]> Committed: Mon Jul 18 16:14:26 2016 -0700 ---------------------------------------------------------------------- .../package/scripts/hive_service_interactive.py | 14 ++++++++++---- .../python/stacks/2.5/HIVE/test_hive_server_int.py | 9 ++++++--- 2 files changed, 16 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/aa259ae4/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_service_interactive.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_service_interactive.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_service_interactive.py index 1edcdca..eaf95ad 100644 --- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_service_interactive.py +++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive_service_interactive.py @@ -87,10 +87,16 @@ def hive_service_interactive(name, action='start', upgrade_type=None): not_if = format("! ({process_id_exists_command})") ) - wait_time = 5 - Execute(daemon_hard_kill_cmd, - not_if = format("! ({process_id_exists_command}) || ( sleep {wait_time} && ! ({process_id_exists_command}) )") - ) + # check if stopped the process, otherwise send hard kill command. + try: + Execute(format("! ({process_id_exists_command})"), + tries=10, + try_sleep=3, + ) + except: + Execute(daemon_hard_kill_cmd, + not_if = format("! ({process_id_exists_command}) ") + ) # check if stopped the process, else fail the task Execute(format("! ({process_id_exists_command})"), http://git-wip-us.apache.org/repos/asf/ambari/blob/aa259ae4/ambari-server/src/test/python/stacks/2.5/HIVE/test_hive_server_int.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.5/HIVE/test_hive_server_int.py b/ambari-server/src/test/python/stacks/2.5/HIVE/test_hive_server_int.py index 2a0674d..a48ebee 100644 --- a/ambari-server/src/test/python/stacks/2.5/HIVE/test_hive_server_int.py +++ b/ambari-server/src/test/python/stacks/2.5/HIVE/test_hive_server_int.py @@ -202,9 +202,12 @@ class TestHiveServerInteractive(RMFTestCase): self.assertResourceCalled('Execute', "ambari-sudo.sh kill 123", not_if="! (ls /var/run/hive/hive-interactive.pid >/dev/null 2>&1 && ps -p 123 >/dev/null 2>&1)", ) - self.assertResourceCalled('Execute', "ambari-sudo.sh kill -9 123", - not_if="! (ls /var/run/hive/hive-interactive.pid >/dev/null 2>&1 && ps -p 123 >/dev/null 2>&1) || ( sleep 5 && ! (ls /var/run/hive/hive-interactive.pid >/dev/null 2>&1 && ps -p 123 >/dev/null 2>&1) )", - ) + self.assertResourceCalled('Execute', + "! (ls /var/run/hive/hive-interactive.pid >/dev/null 2>&1 && ps -p 123 >/dev/null 2>&1)", + tries=10, + try_sleep=3, + ) + self.assertResourceCalled('Execute', "! (ls /var/run/hive/hive-interactive.pid >/dev/null 2>&1 && ps -p 123 >/dev/null 2>&1)", tries=20,
