prefect.concurrency.sync
Functions
concurrency
names: The names of the concurrency limits to acquire slots from.occupy: The number of slots to acquire and hold from each limit.timeout_seconds: The number of seconds to wait for the slots to be acquired before raising aTimeoutError. A timeout ofNonewill wait indefinitely.max_retries: The maximum number of retries to acquire the concurrency slots.lease_duration: The duration of the lease for the acquired slots in seconds.strict: A boolean specifying whether to raise an error if the concurrency limit does not exist. Defaults toFalse.holder: A dictionary containing information about the holder of the concurrency slots. Typically includes ‘type’ and ‘id’ keys.
TimeoutError: If the slots are not acquired within the given timeout.ConcurrencySlotAcquisitionError: If the concurrency limit does not exist andstrictisTrue.
concurrency context manager:
rate_limit
occupy number of slots of the concurrency
limits given in names are acquired. Requires that all given concurrency
limits have a slot decay.
Args:
names: The names of the concurrency limits to acquire slots from.occupy: The number of slots to acquire and hold from each limit.timeout_seconds: The number of seconds to wait for the slots to be acquired before raising aTimeoutError. A timeout ofNonewill wait indefinitely.strict: A boolean specifying whether to raise an error if the concurrency limit does not exist. Defaults toFalse.
TimeoutError: If the slots are not acquired within the given timeout.ConcurrencySlotAcquisitionError: If the concurrency limit does not exist andstrictisTrue.