Add "retry_count" field into workflow execution report
Change-Id: I1c937ff05c4a1f3e28010427c03e3e4f113f6fba Closes-Bug: #1814850
This commit is contained in:
parent
4e926a1f13
commit
6c0bd2a268
|
@ -65,6 +65,11 @@ def analyse_task_execution(task_ex_id, stat, filters, cur_depth):
|
|||
|
||||
child_executions = task_ex.executions
|
||||
|
||||
if 'retry_task_policy' in task_ex.runtime_context:
|
||||
retry_ctx = task_ex.runtime_context['retry_task_policy']
|
||||
|
||||
entry.retry_count = retry_ctx['retry_no']
|
||||
|
||||
entry.action_executions = []
|
||||
entry.workflow_executions = []
|
||||
|
||||
|
|
|
@ -784,6 +784,7 @@ class TaskExecutionReportEntry(BaseExecutionReportEntry):
|
|||
|
||||
action_executions = [ActionExecutionReportEntry]
|
||||
workflow_executions = [WorkflowExecutionReportEntry]
|
||||
retry_count = wtypes.IntegerType(minimum=0)
|
||||
|
||||
@classmethod
|
||||
def sample(cls):
|
||||
|
@ -791,6 +792,7 @@ class TaskExecutionReportEntry(BaseExecutionReportEntry):
|
|||
|
||||
sample.action_executions = [ActionExecutionReportEntry.sample()]
|
||||
sample.workflow_executions = []
|
||||
sample.retry_count = 0
|
||||
|
||||
return sample
|
||||
|
||||
|
|
|
@ -404,3 +404,48 @@ class TestExecutionReportController(base.APITest, engine_base.EngineTestCase):
|
|||
self.assertEqual(0, stat['running_tasks_count'])
|
||||
self.assertEqual(1, stat['success_tasks_count'])
|
||||
self.assertEqual(2, stat['total_tasks_count'])
|
||||
|
||||
def test_retry_count(self):
|
||||
wf_text = """---
|
||||
version: '2.0'
|
||||
|
||||
wf:
|
||||
tasks:
|
||||
task1:
|
||||
action: std.noop
|
||||
on-success: task2
|
||||
|
||||
task2:
|
||||
action: std.fail
|
||||
retry: delay=0.1 count=3
|
||||
"""
|
||||
|
||||
wf_service.create_workflows(wf_text)
|
||||
|
||||
wf_ex = self.engine.start_workflow('wf')
|
||||
|
||||
self.await_workflow_error(wf_ex.id)
|
||||
|
||||
resp = self.app.get('/v2/executions/%s/report' % wf_ex.id)
|
||||
|
||||
self.assertEqual(200, resp.status_int)
|
||||
|
||||
# Now let's verify the response structure
|
||||
|
||||
root_wf_ex = resp.json['root_workflow_execution']
|
||||
|
||||
tasks = root_wf_ex['task_executions']
|
||||
|
||||
self.assertEqual(2, len(tasks))
|
||||
|
||||
# Verify task1 presence.
|
||||
self._assert_single_item(tasks, name='task1', state=states.SUCCESS)
|
||||
|
||||
# Verify task2 info.
|
||||
task2 = self._assert_single_item(
|
||||
tasks,
|
||||
name='task2',
|
||||
state=states.ERROR
|
||||
)
|
||||
|
||||
self.assertEqual(3, task2['retry_count'])
|
||||
|
|
Loading…
Reference in New Issue