Comment 8 for bug 1524477

Revision history for this message
Renat Akhmerov (rakhmerov) wrote : Re: [Bug 1524477] Re: After-task logic runs multiple times if tasks run in parallel

Nope, this is not a solution. I'll explain why later.

Renat

> 15 марта 2016 г., в 3:23, Lingxian Kong <email address hidden> написал(а):
>
> Hi, Renat,
>
> What if we replace _find_next_commands() here
> https://github.com/openstack/mistral/blob/master/mistral/workflow/base.py#L85
> with _find_next_commands_for_task(). I mean, when a task completes, why
> not we just look for subsequent tasks of it, rather than looking for
> subsequent tasks of all completed tasks?
>
> --
> You received this bug notification because you are a bug assignee.
> https://bugs.launchpad.net/bugs/1524477
>
> Title:
> After-task logic runs multiple times if tasks run in parallel
>
> Status in Mistral:
> In Progress
>
> Bug description:
> When executing a workflow with multiple tasks (let's mark them as
> task_a, task_b and task_c ). where some tasks run async actions, such
> as std.mistral_http (task_a), and contain "on-complete" sections . The
> tasks the should run later (in the "on-complete" section) (task_c)
> sometimes run more times then intended.
>
> These tasks are ran from the actual completed task (task_a), but if a
> different task (task_b) is completed at the same time, it sometimes
> runs the task (task_c) again.
>
> This seems to happen since both tasks (task_a and task_b) reach the
> method _on_task_state_change in default_engine.py, and when the
> direct_workflow.py _find_next_commands is called, both start to run
> task_c.
>
> I reproduced this issue using this workflow:
>
> ---
> version: '2.0'
>
> test_tasks:
> tasks:
> task1:
> action: std.mistral_http url="http://google.com"
> on-complete:
> - task4
> task2:
> action: std.mistral_http url="http://google.com"
> on-complete:
> - task5
> task3:
> action: std.mistral_http url="http://google.com"
> on-complete:
> - task6
> task4:
> action: std.echo output='TASK4'
> task5:
> action: std.echo output='TASK5'
> task6:
> action: std.echo output='TASK6'
>
>
> and running execution-update --state SUCCESS for task1, task2, and task3's action-executions concurrently.
>
> this resulted in:
> task 4 running twice: once when task1 finished, and once when task 5 finished.
> task 5 running twice: once when task 2 finished and once when task 3 finished.
> task 6 running twice: once when task 3 finished and once when task 1 finished.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/mistral/+bug/1524477/+subscriptions