solprop.output.resumable#

Whether a results file can continue, rebuild itself, and pass the gate (SEP 41, S17).

resumability() answers three questions about a file separately, so a front end can say which applies without trying a resume:

  • Can it continue, and from where? The position, and the resume= value it needs (True or "interpolated"), or why not: no work left, no checkpoint written before a failure, another output schema, or a writer still alive.

  • Can it be rebuilt from itself? Whether it records a recipe (SEP 41, S2), and whether this solprop reads its format. A file without one can still continue, from the script that wrote it.

  • Does the gate pass? Only on request, at the cost of a rebuild: whether the stored record and the one the recorded recipe rebuilds have one hash (ADR-066).

Module Attributes

ResumeMode

The resume= value a file needs to continue.

Functions

resumability(path, *[, gate])

Say whether a results file can continue, rebuild itself, and pass the gate.

Classes

Resumability(path, resumable, z, mode, ...)

What a results file allows: continuing, rebuilding, and the gate's verdict.

class solprop.output.resumable.Resumability(path, resumable, z, mode, reason, recipe, recipe_format=None, differences=None, gate_error=None)[source]#

Bases: object

What a results file allows: continuing, rebuilding, and the gate’s verdict.

Attributes:
pathpathlib.Path

The file.

resumablebool

Whether a run can continue it.

zfloat or None

Where it would continue from, m; None when it cannot.

mode{True, ‘interpolated’} or None

The resume= value it needs: "interpolated" when its last plane lies inside a step.

reasonstr or None

Why it cannot continue; None when it can.

recipe{‘stored’, ‘none’, ‘newer’}

Whether it records a recipe this solprop reads, none (a file from a script), or one of a newer format.

recipe_formatint or None

The format of the recipe it records.

differencesstr or None

With gate=True and a readable recipe, what separates the stored record from the one the recipe rebuilds: empty when the two have one hash, so that a resume would continue. None when no gate ran.

gate_errorstr or None

With gate=True, why the recipe could not be rebuilt.

differences: str | None = None#
gate_error: str | None = None#
mode: Literal[True, 'interpolated'] | None#
path: Path#
reason: str | None#
property rebuildable: bool[source]#

Return whether the file can rebuild itself.

Returns:
bool

True when it records a recipe this solprop reads.

recipe: Literal['stored', 'none', 'newer']#
recipe_format: int | None = None#
resumable: bool#
z: float | None#
solprop.output.resumable.ResumeMode#

The resume= value a file needs to continue.

alias of Literal[True, ‘interpolated’]

solprop.output.resumable.resumability(path, *, gate=False)[source]#

Say whether a results file can continue, rebuild itself, and pass the gate.

Parameters:
pathstr or pathlib.Path

The HDF5 output.

gatebool, optional

Also rebuild the run from its recorded recipe and compare the records’ hashes, as a resume would (ADR-066), so that, for example, a new optmat release shows before a resume is tried. It costs a rebuild.

Returns:
Resumability

The three answers.

Raises:
OutputError

If the file cannot be read as HDF5.