Runs and records¶
runner
¶
Running experiments and storing their records under their hashes.
Each point of an experiment is one run, stored as a record in the project's
artifact store (ArtifactStore,
namespace experiment) under the point's hash and the engine's identity.
Running an experiment again returns the stored record without computing
anything: the record is the constructive trace of the point, keyed by
everything that determines it. A changed input changes the point hash, so
the point runs again. The computation itself goes through
FitCache, so a run or fit another
experiment (or qvr run --cache) computed is reused too.
Every data file is read and checked against its pin on every invocation, including a cached one: a file whose content no longer matches its pin is refused rather than silently answered from the store.
A record holds the experiment's inputs (entry, content hashes, data digests, values, method, seed, links, handlers, and the source files with their Software Heritage identifiers) and its outputs: for a run, the value and the trace; for a fit, the posterior draws and their summaries.
RECORD_FORMAT
module-attribute
¶
The format of an experiment record.
RECORD_NAMESPACE
module-attribute
¶
The artifact-store namespace experiment records are kept in.
PointRun
didactic-model
¶
PointRun(*, point: ExperimentPoint, key: str, hit: bool, record: JsonValue = field(opaque=True, extras=OPAQUE_BY_IDENTITY))
Bases: ValueModel
The record of one point of an experiment.
| PARAMETER | DESCRIPTION |
|---|---|
point
|
The point.
TYPE:
|
key
|
The record's store key: the point hash with the engine identity.
TYPE:
|
hit
|
Whether the record came from the store.
TYPE:
|
record
|
The record as mutable JSON data, compared by identity.
TYPE:
|
record_key
¶
The store key of a point's record.
| PARAMETER | DESCRIPTION |
|---|---|
point_hash
|
The point hash.
TYPE:
|
engine
|
The engine identity digest.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
str
|
The digest of both: a record is reused only by the engine that computed it. |
Source code in src/quivers/experiments/runner.py
read_data
¶
read_data(plan: ExperimentPlan) -> dict[str, JsonValue]
Read and check every data file of an experiment.
| PARAMETER | DESCRIPTION |
|---|---|
plan
|
The experiment.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
dict[str, JsonValue]
|
Each data clause's value, by the name it is given to. |
| RAISES | DESCRIPTION |
|---|---|
ExperimentError
|
If a file cannot be read or does not match its pin. |
Source code in src/quivers/experiments/runner.py
stored_records
¶
stored_records(plan: ExperimentPlan, *, store: ArtifactStore | None = None, engine: str | None = None) -> tuple[PointRun | None, ...]
The stored records of an experiment's points, without running any.
| PARAMETER | DESCRIPTION |
|---|---|
plan
|
The experiment.
TYPE:
|
store
|
Where records are kept; the project's store when None.
TYPE:
|
engine
|
The engine identity;
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
tuple[PointRun | None, ...]
|
One entry per point, None for a point with no stored record. |
| RAISES | DESCRIPTION |
|---|---|
StoreError
|
If a stored record is corrupt. |
Source code in src/quivers/experiments/runner.py
run_experiment
¶
run_experiment(plan: ExperimentPlan, *, store: ArtifactStore | None = None, engine: str | None = None, rerun: bool = False) -> tuple[PointRun, ...]
Run every point of an experiment, reusing stored records.
| PARAMETER | DESCRIPTION |
|---|---|
plan
|
The experiment.
TYPE:
|
store
|
Where records are kept; the project's store when None.
TYPE:
|
engine
|
The engine identity;
TYPE:
|
rerun
|
Compute every point even when its record is stored, and replace the record.
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
tuple[PointRun, ...]
|
One record per point, in sweep order. |
| RAISES | DESCRIPTION |
|---|---|
ExperimentError
|
If a data file does not match its pin or cannot be read. |
ExecutionFailure
|
If a run fails on the reference machine. |
FitCacheError
|
If a run or fit has no content identity. |
StoreError
|
If a stored record is corrupt. |