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)
wf_trace.info(
None,
"Action execution '%s' [%s -> %s, %s]" %
(self.action_ex.name, prev_state, state, _result_msg())
)
if prev_state != state:
wf_trace.info(
None,
"Action '%s' (%s) [%s -> %s, %s]" %
(self.action_ex.name,
self.action_ex.id,
prev_state,
state,
_result_msg())
)
class PythonAction(Action):

View File

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

View File

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