ExecutionBackend
Note
This page is a reference documentation. It only explains the class signature, and not how to use it. Please refer to the Habitat Guide and Python API guide (v2.0) for usage.
- class ExecutionBackend(*args, **kwargs)[source]
Bases:
ProtocolStrategy for executing subject-level work.
Every scheduling concern that v0.1 kept in the configuration schema – worker counts, per-subject timeouts, graceful shutdown, spawn timeouts, failure policy, OOM backoff, resume – belongs here instead. Algorithms then contain no scheduling code at all, and adding a Dask or cluster backend requires no change to any algorithm.
A backend is an OPTIONAL ACCELERATOR, never a precondition.
op(subject)is always available directly,Cohort.map(op)runs the whole cohort with an implicit serial backend, and an explicit backend is constructed only when the user wants parallelism, timeouts or resume.- map(op: SubjectOperator[TIn, TOut], items: Iterable[TIn], *, checkpoint: 'CheckpointStore' | None = None, progress: Callable[[int, int], None] | None = None) Iterator[SubjectResult[TOut]][source]
Apply a subject-level operation across many subjects.
- Parameters:
op – The subject-level operation to run.
items – Subject-scoped inputs.
checkpoint – Optional store used to skip already-computed subjects and to persist new results as they complete.
progress – Optional callback receiving
(completed, total).
- Returns:
An iterator of per-subject results; each result names its subject so callers can restore the canonical order when a backend completes out of order.
- __init__(*args, **kwargs)