Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Native support for starting and waiting for ChildWorkflow #500

Open
longquanzheng opened this issue Nov 27, 2024 · 0 comments
Open

Native support for starting and waiting for ChildWorkflow #500

longquanzheng opened this issue Nov 27, 2024 · 0 comments

Comments

@longquanzheng
Copy link
Contributor

longquanzheng commented Nov 27, 2024

Context and Goals
Today we let user start "child workflow" from state execution, using context.getChildWorkflowRequestId() for requestId, and then using a signal/internal channel to wait for the childWorkflow to complete.

This pattern works okay, but this is a common pattern of using iWF that we can future improve on:

  1. Write less code to start, and/or wait for the childWF to complete
  2. Metrics: server should emit metrics(IQL) to know which child workflow is started by which parent
  3. Linking: in Temporal WebUI, allow user to quickly find out the child workflowIds using Search Attribute(currently, it's only possible to find out the parent from children).

Proposal
ChildWorkflow can be naively supported with directly API/concepts in SDK.

We can have a new API in Client:
client.startChildWorkflowFromStateExecution( context, workflowId, timeout, ... ) and handle that in api service so that server will know it's starting a childWF. context is required to have context.getChildWorkflowRequestId().

We can also have a new command type:
ChildWorkflowCompletionCommand.create(workflowId) to wait for the childWF to complete.

  • Metrics can be easily done as long as server knows there is a childWorkflow is started.
  • Linking can be done by using a system search attribute like IwfParentId, and set the SA on childWFs when starting the childWFs. (Then we can find the childWFs using query like IwfParentId="myParent123“.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant