Parallel Task support in workflows #14946
6TELOIV
started this conversation in
Feature Requests & Ideas
Replies: 1 comment
-
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
It would be nice if workflows could kick off parallel tasks nicely:
Current (incomplete) Solutions
Currently, if I do something like this:
and doSomething fails before fooBar finishes, then fooBar is retried while the first run is still going, and the outcome of the first run of fooBar is ignored.
This is due to the nature of
Promise.alland how it re-throws the first promise that rejects, and how Payload's workflow handles errors, depending on type.TaskErrorwill handle the task's retries, and will handle the workflow's retries if the task still has more retries.Alternatively, you could avoid the issue of the workflow finishing too quickly using
Promise.allSettled, but then you have an issue when multiple sub-tasks fail, and there is no appropriate error to throw that payload will handle correctly to update the tasks and workflow.Proposed Implementation
Implementing a
parallelfunction for workflows could look something like the following:AggregateTaskErrortype which can recieve multiple task failureshandleTaskErrorfunction tohandleAggregateTaskErrorinsteadhandleTaskErrormany times, it would update the workflow many times.TaskErrors in to anAggregateTaskErrorwith only one error. As it's only called in one place (runJob) changing it's behavior doesn't seem too complicated.parallelTasksfunction, which would look something like the following (types might be wrong, but functionality is there):runJobto passrunParrallelTasksfunction, and update error handling to usehandleAggregateTaksErrorand convert singleTaskErrorsinto aggregate, i.e.handleAggregateTaksError(new AggregateTaskError([error]))Beta Was this translation helpful? Give feedback.
All reactions