StackStorm / StackStorm/st2

Ability to retry child workflow tasks from parent workflow

Open
#5,024 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement proposal workflows: orquesta
Dominant language
Python
Stars
6.5k
Forks
787
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with st2common/services/workflows.py around line 505 and review the existing task re-run behavior described in the Orquesta operations documentation. Trace how a dotted parent.child task path could locate the child workflow and recurse into it. Done means a child task can be re-run from the parent execution while preserving continuation and avoiding duplicate earlier work.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, devops
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.