Skip to content

nodus.sweep

View Markdown

Sweep: one Job template run across a matrix of GPUs, regions and parameters (resources.md §3.3, ADR-051).

Sweep(job_spec, grid={"gpu": ["H100", "L4"], "BATCH_SIZE": [8, 16]}) describes the matrix and run() creates it; each cell is a Job named <sweep>-<index> and the report lists cost, wall time and throughput per cell. The API serves Job templates, so a Function or a recipe as the target raises errors.Unsupported.

class Sweep(target: Mapping[str, Any] | None = None, *, grid: Mapping[str, Iterable[Any] | str] | None = None, repetitions: int | None = None, max_parallel: int | None = None, max_cost: Any = None, name: str | None = None, labels: dict[str, str] | None = None, project: str | None = None) -> None

A Sweep: describe it, run() it, then read the report with wait(), cells() and status().

cancel() -> None
cells() -> list[View]

One entry per cell, in index order: GPU, region, parameters, phase, cost, wall time and throughput.

estimate() -> View

The Sweep’s status.estimate: the total cost estimate over every cell.

from_name(name: str, project: str | None = None) -> _Sweep

A Sweep that exists already, to wait on or read.

jobs() -> list[View]

The cell Jobs the Sweep created.

Type: str | None

The Sweep’s name; a Sweep without one gets it from run().

resume() -> None
run(idempotency_key: str | None = None) -> _Sweep

Create the Sweep and return it; .wait() blocks until every cell is terminal.

status() -> View

The Sweep’s status: phase, cells, best, cost and estimate.

suspend() -> None
wait(timeout: float | None = None) -> View

Block until the Sweep is terminal and return its report (the status).

A Sweep with failed cells ends Failed with reason CellsFailed and still has its report, so only a timeout or a missing Sweep raises; read phase and best on the result.