api.worker.run_store

What the worker keeps in Redis about scripts: their run history, their last snapshot, the stage each running script is at, and the per-record locks.

Attributes

Classes

Module Contents

api.worker.run_store.STAGE_TTL_SECONDS = 3600
api.worker.run_store.LOCK_TTL_SECONDS = 600
api.worker.run_store.MAX_RUNS_PER_SCRIPT = 1000
class api.worker.run_store.RunStore(client: redis.Redis[str])
client
record(script: str, result: dict[str, Any]) → None
recent(script: str, limit: int = 20, offset: int = 0) → list[dict[str, Any]]
count(script: str) → int
get_snapshot(script: str) → dict[str, Any] | None
set_snapshot(script: str, snapshot: dict[str, Any]) → None
set_stage(script: str, stage: str, record_id: str | None = None) → None
get_stage(script: str, record_id: str | None = None) → dict[str, Any] | None
clear_stage(script: str, record_id: str | None = None) → None
get_all_stages(script: str) → list[dict[str, Any]]

The stage of every run of this script in progress (one per record), oldest first.

acquire_lock(script: str, record_id: str) → bool

False when the same script is already running for this record.

release_lock(script: str, record_id: str) → None