class*args, **kwargs)

Bases: Protocol

class Lease)

Bases: object

property lease: Lease

Returns the lease

property tenant_completed: bool

Returns True if the work has completed or sucessfully stopped its work.

property lease_cancelled: bool

Returns True if the lease has been cancelled.

cancel_lease() None

Cancel the lease.

get_lease_state() LeaseState

Returns the LeaseState.

update_lease_result(result: Any) None

Update the lease result.


result (Any) – The result of the lease.

update_lease_state(state: LeaseState) None

Update the lease state.


state (LeaseState) – State of the lease.

update_lease_status(status: Status) None

Update the lease status.


status (Status) – Status of the lease.

async run_work(work: WorkItem, context: Any | None = None, executor: Executor | None = None) Lease

Runs work.

Work is run in an executor.

  • work (func) – Work to do.

  • context (context) – Context for work.

  • executor (ThreadPoolExecutor) – Thread pool for work to run on.