You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by st...@apache.org on 2016/05/18 07:14:24 UTC
ambari git commit: AMBARI-16630. Extend logging for ActionQueue's
retry logic. (Daniel Gergely via stoader)
Repository: ambari
Updated Branches:
refs/heads/branch-2.4 8e0234756 -> 34f5cbb2d
AMBARI-16630. Extend logging for ActionQueue's retry logic. (Daniel Gergely via stoader)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/34f5cbb2
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/34f5cbb2
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/34f5cbb2
Branch: refs/heads/branch-2.4
Commit: 34f5cbb2d5335d24bdcb6285793783f71a7b3489
Parents: 8e02347
Author: Daniel Gergely <dg...@hortonworks.com>
Authored: Tue May 17 22:32:46 2016 +0200
Committer: Toader, Sebastian <st...@hortonworks.com>
Committed: Wed May 18 09:13:33 2016 +0200
----------------------------------------------------------------------
ambari-agent/src/main/python/ambari_agent/ActionQueue.py | 8 ++++++--
ambari-agent/src/test/python/ambari_agent/TestActionQueue.py | 4 ++--
2 files changed, 8 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/34f5cbb2/ambari-agent/src/main/python/ambari_agent/ActionQueue.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/ActionQueue.py b/ambari-agent/src/main/python/ambari_agent/ActionQueue.py
index 85389f9..19bd18f 100644
--- a/ambari-agent/src/main/python/ambari_agent/ActionQueue.py
+++ b/ambari-agent/src/main/python/ambari_agent/ActionQueue.py
@@ -283,8 +283,8 @@ class ActionQueue(threading.Thread):
if isAutoExecuteCommand:
retryAble = False
- logger.debug("Command execution metadata - retry enabled = {retryAble}, max retry duration (sec) = {retryDuration}".
- format(retryAble=retryAble, retryDuration=retryDuration))
+ logger.info("Command execution metadata - taskId = {taskId}, retry enabled = {retryAble}, max retry duration (sec) = {retryDuration}".
+ format(taskId=taskId, retryAble=retryAble, retryDuration=retryDuration))
while retryDuration >= 0:
numAttempts += 1
start = 0
@@ -303,6 +303,8 @@ class ActionQueue(threading.Thread):
# dumping results
if isCommandBackground:
+ logger.info("Command is background command, quit retrying. Exit code: {exitCode}, retryAble: {retryAble}, retryDuration (sec): {retryDuration}, last delay (sec): {delay}"
+ .format(cid=taskId, exitCode=commandresult['exitcode'], retryAble=retryAble, retryDuration=retryDuration, delay=delay))
return
else:
if commandresult['exitcode'] == 0:
@@ -320,6 +322,8 @@ class ActionQueue(threading.Thread):
time.sleep(delay)
continue
else:
+ logger.info("Quit retrying for command id {cid}. Status: {status}, retryAble: {retryAble}, retryDuration (sec): {retryDuration}, last delay (sec): {delay}"
+ .format(cid=taskId, status=status, retryAble=retryAble, retryDuration=retryDuration, delay=delay))
break
# final result to stdout
http://git-wip-us.apache.org/repos/asf/ambari/blob/34f5cbb2/ambari-agent/src/test/python/ambari_agent/TestActionQueue.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/ambari_agent/TestActionQueue.py b/ambari-agent/src/test/python/ambari_agent/TestActionQueue.py
index 7d0efa2..0fd3bff 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestActionQueue.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestActionQueue.py
@@ -986,7 +986,7 @@ class TestActionQueue(TestCase):
'status': 'FAILED'
}
- times_arr = [8, 10, 14, 18, 22, 26]
+ times_arr = [8, 10, 14, 18, 22, 26, 30, 34]
if self.logger.isEnabledFor(logging.INFO):
times_arr.insert(0, 4)
time_mock.side_effect = times_arr
@@ -1003,7 +1003,7 @@ class TestActionQueue(TestCase):
self.assertTrue(runCommand_mock.called)
self.assertEqual(2, runCommand_mock.call_count)
self.assertEqual(1, sleep_mock.call_count)
- sleep_mock.assert_has_calls([call(2)], False)
+ sleep_mock.assert_has_calls([call(1)], False)
runCommand_mock.assert_has_calls([
call(command, os.sep + 'tmp' + os.sep + 'ambari-agent' + os.sep + 'output-19.txt',
os.sep + 'tmp' + os.sep + 'ambari-agent' + os.sep + 'errors-19.txt', override_output_files=True, retry=False),