Skip to content

leases

etl_craft.execution.leases

Process identities and heartbeat scopes for run and attempt supervisors.

RunSupervisor dataclass

A run's exact owner and the cancellation shared by its wave tasks.

process_start

process_start(pid: int) -> str | None

Read a process birth identity, including the boot identity on Linux.

owner_id

owner_id() -> str

Identify this supervisor's host, pid, birth time and random instance suffix.

run_owner

run_owner(run_id: int) -> str | None

Return the supervisor in this execution scope for this exact run.

run_cancel

run_cancel() -> threading.Event

Return the supervising run's cancellation, or a standalone task event.

heartbeat

heartbeat(engine: Engine, kind: str, row_id: int, owner: str, cancel: Event) -> Iterator[None]

Renew a lease while its process runs; stop work when ownership cannot be renewed.

supervise_run

supervise_run(engine: Engine, run_id: int, *, cancel: Event | None = None) -> Iterator[None]

Claim and heartbeat one run; no other supervisor can adopt its live or expired lease.