prefect_redis.locking
Classes
RedisLockManager
A lock manager that uses Redis as a backend.
Attributes:
host: The host of the Redis serverport: The port the Redis server is running ondb: The database to write to and read fromusername: The username to use when connecting to the Redis serverpassword: The password to use when connecting to the Redis serverssl: Whether to use SSL when connecting to the Redis serverclient: The Redis client used to communicate with the Redis serverasync_client: The asynchronous Redis client used to communicate with the Redis server
aacquire_lock
key: Unique identifier for the transaction record.holder: Unique identifier for the holder of the lock. Must match the holder provided when acquiring the lock.acquire_timeout: Maximum time to wait for the lock to be acquired.hold_timeout: Maximum time to hold the lock.
- True if the lock was acquired, False otherwise.
acquire_lock
key: Unique identifier for the transaction record.holder: Unique identifier for the holder of the lock.acquire_timeout: Maximum time to wait for the lock to be acquired.hold_timeout: Maximum time to hold the lock.
- True if the lock was acquired, False otherwise.
await_for_lock
is_lock_holder
is_locked
release_lock
key: Unique identifier for the transaction record.holder: Unique identifier for the holder of the lock. Must match the holder provided when acquiring the lock.
ValueError: If the lock is held by a different holder.