You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by sw...@apache.org on 2016/12/01 08:13:48 UTC
[05/50] ambari git commit: AMBARI-18982. Failures due to timeout
don't report any reason (aonishuk)
AMBARI-18982. Failures due to timeout don't report any reason (aonishuk)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5bdcc418
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5bdcc418
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5bdcc418
Branch: refs/heads/branch-feature-AMBARI-18901
Commit: 5bdcc418f404220f04c604413ebbf8ddd48470df
Parents: 4e4a1f9
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Mon Nov 28 12:37:44 2016 +0200
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Mon Nov 28 12:37:44 2016 +0200
----------------------------------------------------------------------
.../main/python/ambari_agent/CustomServiceOrchestrator.py | 9 +++++----
.../python/ambari_agent/TestCustomServiceOrchestrator.py | 4 ++--
.../apache/ambari/server/actionmanager/ActionScheduler.java | 2 +-
3 files changed, 8 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/5bdcc418/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py b/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
index 770484d..ebd3506 100644
--- a/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
+++ b/ambari-agent/src/main/python/ambari_agent/CustomServiceOrchestrator.py
@@ -223,7 +223,7 @@ class CustomServiceOrchestrator():
# if canceled and not background command
if handle is None:
cancel_reason = self.command_canceled_reason(task_id)
- if cancel_reason:
+ if cancel_reason is not None:
ret['stdout'] += cancel_reason
ret['stderr'] += cancel_reason
@@ -251,10 +251,11 @@ class CustomServiceOrchestrator():
logger.debug('Pop with taskId %s' % task_id)
pid = self.commands_in_progress.pop(task_id)
if not isinstance(pid, int):
- if pid:
- return '\nCommand aborted. ' + pid
+ reason = pid
+ if reason:
+ return "\nCommand aborted. Reason: '{0}'".format(reason)
else:
- return ''
+ return "\nCommand aborted."
return None
def requestComponentStatus(self, command):
http://git-wip-us.apache.org/repos/asf/ambari/blob/5bdcc418/ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py b/ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py
index 2be6e1a..0304adc 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestCustomServiceOrchestrator.py
@@ -400,8 +400,8 @@ class TestCustomServiceOrchestrator(TestCase):
ret = async_result.get()
self.assertEqual(ret['exitcode'], 1)
- self.assertEquals(ret['stdout'], 'killed\nCommand aborted. reason')
- self.assertEquals(ret['stderr'], 'killed\nCommand aborted. reason')
+ self.assertEquals(ret['stdout'], 'killed\nCommand aborted. Reason: \'reason\'')
+ self.assertEquals(ret['stderr'], 'killed\nCommand aborted. Reason: \'reason\'')
self.assertTrue(kill_process_with_children_mock.called)
self.assertFalse(command['taskId'] in orchestrator.commands_in_progress.keys())
http://git-wip-us.apache.org/repos/asf/ambari/blob/5bdcc418/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
index 7a84536..e80b020 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/actionmanager/ActionScheduler.java
@@ -1246,7 +1246,7 @@ class ActionScheduler implements Runnable {
hostRoleCommand.getStatus() == HostRoleStatus.IN_PROGRESS) {
CancelCommand cancelCommand = new CancelCommand();
cancelCommand.setTargetTaskId(hostRoleCommand.getTaskId());
- cancelCommand.setReason("");
+ cancelCommand.setReason("Stage timeout");
actionQueue.enqueue(hostRoleCommand.getHostName(), cancelCommand);
}
}