Skip to main content
Use this when the same sequence is needed in several workflows, or one round of work has to be repeated from a parent. A SUB_WORKFLOW node runs another workflow of the same session for each message, waits for it and emits the outcome. Why you would, and what it costs, is in How sub-workflows work.

Steps

1

Write the child

The child is a normal workflow. Its OUTCOME_TERMINAL names the exit it took. Here a check command runs and the child ends SUCCESS when it passes; a failing command fails the child. Save the whole session as pipeline.json:
pipeline.json
2

Call it from the parent

The node’s options:Without routeByOutcome a failing child fails the node, and the parent’s failure handling applies.
3

Apply and start the parent

Verify it worked

The RESULT event comes from ship, with a payload {executionId, results, status, outcome} where outcome is SUCCESS and executionId is the child’s. The tree lists the parent and the child run. Change the command to exit 3, apply again and start: the result now comes from stop-here, and the parent run still ends SUCCESS, because the failure was routed, not raised.

Variations

  • Outcome terminals. OUTCOME_TERMINAL also takes RETRY and ESCALATE (with restartFrom and reason), which leave on the ports of the same names.
  • Pass less than the whole message. Set payload; the child reads it as ${start...} from every node (Use variables and expressions).

Limits

  • Nesting is capped at 5 levels; deeper is refused.
  • A child runs on the slot its parent holds, so yukta.execution.max-concurrent must allow the parent and its children together.
  • A SUB_WORKFLOW node cannot run on a remote worker, and stopping the node cancels the child.