Updated
On this page
PG advisory-lock helpers keyed by run UUID (pg_try_advisory_lock/unlock) plus heartbeat tracking; is_lock_stale reports whether a run heartbeat is overdue, for crash detection.
#trace.src.orxtra.trace._lock
#trace.src.orxtra.trace._lock
#RunLockError
python
class RunLockError(Exception):#lock_key
python
def lock_key(run_id: UUID) -> intCompute the advisory lock key for a run ID.
#acquire_run_lock
python
async def acquire_run_lock(pool: asyncpg.Pool, run_id: UUID) -> None#release_run_lock
python
async def release_run_lock(pool: asyncpg.Pool, run_id: UUID) -> None#update_heartbeat
python
async def update_heartbeat(pool: asyncpg.Pool, run_id: UUID) -> None#is_lock_stale
python
async def is_lock_stale(pool: asyncpg.Pool, run_id: UUID, threshold_seconds: float=300.0) -> bool