Ability to retry child workflow tasks from parent workflow
Problem:
We cannot re-run a child workflow task from a parent workflow.
Description
Often times a parent workflow will only have 3 tasks. The child workflow will have up to 20 or more tasks.
When the child workflow fails at task 19 we are only able to restart the child workflow at task 20. This will not continue the Parent workflow at task2.
Why are our workflows structured like this? Often times we need to slightly alter some logic for sensor based workflow calls vs manual based workflow calls. The child workflow allows the code to be reused in both parent workflows for sensor and manual runs.
Why do we want to rerun? Sometimes network errors lead to remote ssh runners failing. Rerunning from the parent task1 would do all the earlier steps and duplicate work.
Stackstorm has the ability to restart a workflow from a specific task using the syntax st2 execution re-run <execution-id> --tasks <task_name>
https://docs.stackstorm.com/orquesta/operations.html#re-running-workflow-execution-from-task-s
Proposed UI solution:
allow ability to re-run child workflow tasks like so
st2 execution re-run <execution-id> --tasks <task_name>.<child_task_name>
Developer Notes
My initial research led me to this section of code and a possible solution
https://github.com/StackStorm/st2/blob/d61b563c418f0f82f339a67053df421c8bbbc6c1/st2common/st2common/services/workflows.py#L505 1.tasks = split task on dot 2. find tasks[0] task in workflow 3. if tasks[1] exists then set this task as running and recurse into this function using tasks[1] and workflow from tasks[0] if it is a workflow
@guzzijones Thanks for the detailed problem description and proposal!
@m4dcoder what do you think about this proposal?
@guzzijones @armab +1 on the proposal. Just be sure to catch the edge case. Take this workflow https://github.com/StackStorm/orquesta/blob/master/orquesta/tests/fixtures/workflows/native/split.yaml for example, there are exactly two separate instances for the branch task4->task5->task6->task7. In the proposal, if this workflow is the sub workflow, just make sure the child task name knows how to identify which branch to re-run.
I would love this feature! 🆙