prefect.concurrency.services
Classes
ConcurrencySlotAcquisitionService
Methods:
acquire
ConcurrencySlotAcquisitionWithLeaseService
A service that acquires concurrency slots with leases.
This service serializes acquisition attempts for a given set of limit names,
preventing thundering herd issues when many tasks try to acquire slots simultaneously.
Each unique set of limit names gets its own singleton service instance.
Args:
concurrency_limit_names: A frozenset of concurrency limit names to acquire slots from.
acquire
slots: Number of slots to acquiremode: Either “concurrency” or “rate_limit”timeout_seconds: Optional timeout for the entire acquisition attemptmax_retries: Maximum number of retries on 423 LOCKED responseslease_duration: Duration of the lease in secondsstrict: Whether to raise errors for missing limitsholder: Optional holder information for the lease
- HTTP response from the server
httpx.HTTPStatusError: If the server returns an error other than 423 LOCKEDTimeoutError: If acquisition times out