Skip to main content

Module parallel

Module parallel 

Source
Expand description

Ordered, bounded-concurrency parallel map/reduce with a configurable failure policy.

Graph Send fanout is the low-level primitive for parallel supersteps, but callers frequently want a reusable “run these N items concurrently and reduce the results” helper with deterministic input-order results, a concurrency cap, per-item success/failure isolation, and a policy for what to do when some items fail (fail-fast, collect-all, quorum, best-effort). That is what map_reduce provides, independent of the graph executor.

Results are always returned in input order even though items complete out of order: concurrency is driven by buffer_unordered, which yields items as they finish, and each future carries its input index so the completed results are re-sorted into input-order slots before being returned.

Structs§

DispatchPlan
Which workers may run concurrently, in input order.
ItemOutcome
The outcome of one item in a parallel map/reduce, tagged with its input index so callers can correlate results back to inputs.
ParallelOptions
Options controlling parallel execution.
ParallelOutcome
The collected result of a parallel map/reduce, preserving input order.
WorkspaceClaim
One worker’s declared relationship to a fan-out’s shared workspace.

Enums§

ClaimConflict
Why a worker cannot be scheduled against the shared workspace.
ClaimPathError
Why a claim string could not be parsed into safe relative paths.
DispatchMode
How a worker must be dispatched relative to its siblings.
FailurePolicy
What map_reduce does when some items fail.

Functions§

map_reduce
Runs f over items concurrently (bounded by ParallelOptions::max_concurrency), collecting per-item outcomes in input order and applying the configured FailurePolicy.
parse_relative_claim_paths
Parses a claim list into safe, sorted, deduplicated relative paths.
paths_overlap
true when two claimed paths cannot be held by different workers at once.
plan_shared_workspace_dispatch
Decides which workers may run concurrently against one shared workspace.
writes_shared_workspace
true when a tool’s declared effects can mutate a shared workspace.