You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: expose max_parallel_workers parameter on workflow.node decorator and Node class
Expose `max_parallel_workers` on the `@workflow.node` decorator and `Node` class when `parallel_worker=True`. This allows throttling the concurrency limit when executing parallel workers.
Co-authored-by: Shangjie Chen <deanchen@google.com>
PiperOrigin-RevId: 940663519
Copy file name to clipboardExpand all lines: docs/guides/workflow/parallel_worker/index.md
+1-2Lines changed: 1 addition & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -7,7 +7,7 @@
7
7
When processing a list of items (e.g., a list of documents to analyze, queries to run, or topics to explain), running them sequentially can be slow, especially if the processing node performs I/O-bound operations like calling an LLM or an external API. `ParallelWorker` solves this by executing the wrapped node concurrently for all items in the input list, significantly reducing total execution time.
8
8
9
9
Key features:
10
-
-**Concurrency**: Runs multiple instances of the wrapped node in parallel.
10
+
-**Concurrency**: Runs multiple instances of the wrapped node in parallel (optionally throttled via `max_parallel_workers`).
11
11
-**Aggregation**: Gathers all outputs and returns them as a single list, maintaining the original order of the inputs.
12
12
-**Error Propagation**: If any parallel task fails, all other pending tasks are cancelled, and the error is raised immediately.
13
13
@@ -64,7 +64,6 @@ If the wrapped node triggers an interrupt (e.g., `RequestInput`), the parallel w
64
64
65
65
-**List Input**: The worker always expects a list and returns a list. If your upstream node doesn't produce a list, it will be treated as a list of one item.
66
66
-**Fail-Fast**: The failure of a single item fails the entire worker and cancels all other items. There is currently no "continue on error" option to collect partial results.
67
-
-**No Concurrency Limit**: Setting `max_concurrency` to limit the number of parallel tasks is not supported yet. All items in the list will be processed concurrently.
0 commit comments