conatus.runs.Registry

class conatus.runs.Registry(root=None)[source]

Bases: object

A registry root: run directories + index. Cheap to create (nothing is opened until used).

Parameters:

root (str | os.PathLike | None)

explain()[source]
Return type:

str

run_dir(run_id)[source]

The directory of run run_id (one path component: no separator, never “.” or “..”, no NUL; security get(“../../x”) left the registry).

Parameters:

run_id (str)

Return type:

Path

load(run_id)[source]

The record of one run (run.json).

Parameters:

run_id (str)

Return type:

dict

index(rec)[source]

Insert / replace one run in the index (called by the run’s writer thread).

Parameters:

rec (Mapping[str, Any])

Return type:

None

sync()[source]

Reconcile the index with the run directories: add / refresh runs whose run.json changed, drop entries whose directory is gone. Returns counts; never raises on one bad record (it is reported in skipped).

Return type:

dict

reindex()[source]

Drop the index and rebuild it from the run directories.

Return type:

dict

resolve_id(run_id)[source]

Full id from an id, a unique prefix, or a Run object.

Parameters:

run_id (Any)

Return type:

str

query_ids(*, problem=None, name=None, status=None, state=None, tags=None, parent=None, since=None, until=None, limit=None, order='-created', filters=None)[source]

Ids matching every criterion (AND). See conatus.runs.find() for the key rules.

Parameters:
  • problem (Any)

  • name (str | None)

  • status (str | Iterable[str] | None)

  • state (str | Iterable[str] | None)

  • tags (str | Iterable[str] | None)

  • parent (Any)

  • since (Any)

  • until (Any)

  • limit (int | None)

  • order (str)

  • filters (Mapping[str, Any] | None)

Return type:

list[str]

children(run_id)[source]
Parameters:

run_id (str)

Return type:

list[str]

cache_lookup(key)[source]

Newest completed, non-retracted run with this cache key and a stored output.

Parameters:

key (str)

Return type:

str | None

update_status(run_id, status, reason, evidence, utc)[source]

Read-modify-write of one run’s status under its lock; history kept (never rewritten).

Parameters:
  • run_id (str)

  • status (str)

  • reason (str)

  • evidence (Any)

  • utc (str)

Return type:

dict