conatus.runs.Run¶
- class conatus.runs.Run(registry, name, *, tags=(), params=None, obj=None, parent=None, relation=None, status='provisional', telemetry=None, capacity=256, notes=None, key_parts=None, _record=None)[source]¶
Bases:
objectA registry run. Created live by
conatus.runs.track()/conatus.runs.record()/solver.run(record=...), or read back byconatus.runs.get()/find.Live methods:
log()(series),result()(scalar results),save_field(),save_file(),attach()(a Problem / Plan / solver: numerics andexplain()),certify()/retract(),close(). Read methods:params,results,series(),load_field(),file_path(),explain(),reproduce(),lineage().- Parameters:
registry (Registry)
name (str)
tags (Iterable[str])
params (Mapping[str, Any] | None)
obj (Any)
parent (Any)
relation (str | None)
status (str)
telemetry (Any)
capacity (int)
notes (str | None)
key_parts (dict | None)
_record (dict | None)
- property name: str¶
- property status: str¶
- property state: str¶
- property params: dict¶
- property results: dict¶
- property tags: list[str]¶
- property parent: str | None¶
- property path: Path¶
- property cache_report: dict | None¶
- attach(obj)[source]¶
Record the problem hash, the numerical configuration (
conatus.provenance.numerics) and theexplain()text of a Problem, Plan or solver. The problem’s parameter values (IRParametervalues, overridden bydiscretize(params=...)) join the run parameters; a parameter declared twice with different values is refused.- Parameters:
obj (Any)
- Return type:
- log(step=None, **scalars)[source]¶
Append one row of series values (
run.log(t=t, energy=E));stepis optional (the row number is always kept, so series logged together can be plotted against each other). In-memory only; written todata.h5at close.- Parameters:
step (int | None)
scalars (Any)
- Return type:
None
- result(**values)[source]¶
Scalar results (numbers, strings, booleans, complex): stored in
run.jsonand indexed, sofind(Nu__gt=...)works.- Parameters:
values (Any)
- Return type:
None
- save_field(name, array, *, compression, level=None, t=None, step=None)[source]¶
Queue a copy of
arrayfordata.h5(fields/<name>/<k>).compressionhas no default (None, ‘gzip’ or ‘lzf’, all lossless;level0–9 for gzip) and is written in the dataset’s attributes. Returns False if the queue was full (dropped, counted).- Parameters:
name (str)
array (Any)
compression (str | None)
level (int | None)
t (float | None)
step (int | None)
- Return type:
bool
- save_file(path, name=None)[source]¶
Queue a copy of a file into
files/(sha256 recorded). The copy is taken by the writer thread: a file changed right after this call may be copied changed.- Parameters:
path (str | PathLike)
name (str | None)
- Return type:
bool
- set_status(status, reason, evidence=None)[source]¶
Change the status (history kept, never rewritten).
reasonis required.- Parameters:
status (str)
reason (str)
evidence (Any)
- Return type:
- certify(reason, evidence=None)[source]¶
Mark the run
certified(reason and optional evidence, e.g. residuals, recorded).- Parameters:
reason (str)
evidence (Any)
- Return type:
- retract(reason)[source]¶
Mark the run
retracted(kept, never deleted; never reused by the cache).- Parameters:
reason (str)
- Return type:
- close(state='completed', error=None, timeout=600.0)[source]¶
Finish the run: series to
data.h5, finalrun.json, index. Waits for the writer at mosttimeouts. Idempotent. Warns (RegistryWriteWarning) if anything was lost.- Parameters:
state (str)
error (str | None)
timeout (float)
- Return type:
- series(name, x=None)[source]¶
{“row”, “step”, “value”} arrays of one series; with
x(another series logged in the same rows, e.g. “t”), also “x” aligned on the rows both have (no interpolation).- Parameters:
name (str)
x (str | None)
- Return type:
dict
- load_field(name, index=-1)[source]¶
One saved snapshot of a field (default: the last one).
- Parameters:
name (str)
index (int)
- Return type:
ndarray
- file_path(name)[source]¶
The attached file
nameof this run (a plain file name: no directory part, never “.” or “..”; security name=”../../x” read outside the run).- Parameters:
name (str)
- Return type:
Path
- reproduce(solver=None, **kw)[source]¶
Run this computation again and compare (see
conatus.runs.reproduce()).- Parameters:
solver (Any)
kw (Any)