Slightly improve workflow trace logging

Change-Id: Ia5e8dd621cca67bafa8631252315e7617ffa8555
This commit is contained in:
Renat Akhmerov 2016-08-10 19:21:51 +07:00
parent c58671344e
commit 4bdda3b6ed
3 changed files with 24 additions and 13 deletions

View File

@ -174,11 +174,16 @@ class Action(object):
return "result = %s" % utils.cut(result.data) return "result = %s" % utils.cut(result.data)
wf_trace.info( if prev_state != state:
None, wf_trace.info(
"Action execution '%s' [%s -> %s, %s]" % None,
(self.action_ex.name, prev_state, state, _result_msg()) "Action '%s' (%s) [%s -> %s, %s]" %
) (self.action_ex.name,
self.action_ex.id,
prev_state,
state,
_result_msg())
)
class PythonAction(Action): class PythonAction(Action):

View File

@ -96,7 +96,7 @@ class Task(object):
if not self.task_ex: if not self.task_ex:
self._create_task_execution() self._create_task_execution()
self.set_state(states.WAITING, 'Task execution is deferred.') self.set_state(states.WAITING, 'Task is deferred.')
self.waiting = True self.waiting = True
@ -114,11 +114,17 @@ class Task(object):
assert self.task_ex assert self.task_ex
wf_trace.info( if (self.task_ex.state != state or
self.task_ex.workflow_execution, self.task_ex.state_info != state_info):
"Task execution '%s' [%s -> %s]: %s" % wf_trace.info(
(self.task_ex.id, self.task_ex.state, state, state_info) self.task_ex.workflow_execution,
) "Task '%s' (%s) [%s -> %s, msg=%s]" %
(self.task_ex.name,
self.task_ex.id,
self.task_ex.state,
state,
state_info)
)
self.task_ex.state = state self.task_ex.state = state
self.task_ex.state_info = state_info self.task_ex.state_info = state_info

View File

@ -243,8 +243,8 @@ class Workflow(object):
wf_trace.info( wf_trace.info(
self.wf_ex, self.wf_ex,
"Execution of workflow '%s' [%s -> %s]" "Workflow '%s' [%s -> %s, msg=%s]"
% (self.wf_ex.workflow_name, cur_state, state) % (self.wf_ex.workflow_name, cur_state, state, state_info)
) )
else: else:
msg = ("Can't change workflow execution state from %s to %s. " msg = ("Can't change workflow execution state from %s to %s. "