-
Notifications
You must be signed in to change notification settings - Fork 1
Add quorum parameter to WorkerPool and WorkerProxy #144
Copy link
Copy link
Open
Labels
featureNew feature or capabilityNew feature or capability
Description
Summary
Add a quorum: int | None = None parameter to WorkerProxy and WorkerPool that makes _start() block until len(workers) >= quorum before returning. This ensures a minimum number of workers are discovered before the proxy considers itself started, whether that happens eagerly via start() or lazily on first dispatch().
Motivation
Currently there is no way to require a minimum number of workers before dispatch begins. _await_workers() only waits for at least one worker. For workloads that require a minimum level of parallelism — such as map-reduce, ensemble inference, or sharded computation — callers need a guarantee that enough workers are present before the first task is routed.
Expected outcome
WorkerProxy(discovery=..., quorum=3)makes_start()block until at least 3 workers are discovered- If
leaseis set andquorum > lease, raiseValueErrorat construction — the quorum can never be satisfied - Lazy semantics are preserved: for
lazy=Truepools, the quorum blocks on firstdispatch(); forlazy=Falsepools, it blocks onstart()/__aenter__ WorkerPoolforwardsquorumto the underlyingWorkerProxy
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
featureNew feature or capabilityNew feature or capability