plesty.server.services.run_report
A finished run, compiled into one HTML file.
What a measurement is worth to somebody who was not standing there: what was run and how it was configured, what the instruments were, what came out, and what the analyzers made of it. All of that is already in the run directory — this reads it and lays it out, and invents nothing.
The run is read directly, not through plesty-lib’s readers. An experiment
runs in an environment of its own, so the library that wrote a run’s documents
is routinely newer than the one the console has: a bench on plesty-lib 0.4.1
cannot load a document whose type is experiment_data, which 0.5 added,
and would refuse to report a run it can plainly see. The formats read here —
JSON Lines for the journal and the records, a document beside its .npz for
an analysis — are the stable part, so reading them by hand is what makes the
report work across the version skew a real bench has.
One file, no script, nothing fetched. The stylesheet is inlined and the
markup comes from assets/report.html; the report has to open from a USB
stick, from an attachment, and in ten years.
Attributes
Exceptions
The run could not be read well enough to report on. |
Functions
|
Compile the run at run_dir into one self-contained HTML document. |
|
Compile the run and write it to target; returns the path written. |
|
A file name for the run's report, findable by what it is a report of. |
Module Contents
- plesty.server.services.run_report.MAX_ROWS = 500
- exception plesty.server.services.run_report.ReportError
Bases:
RuntimeErrorThe run could not be read well enough to report on.
Initialize self. See help(type(self)) for accurate signature.
- plesty.server.services.run_report.report(run_dir: str | pathlib.Path, experiment: str = '') str
Compile the run at run_dir into one self-contained HTML document.
- Parameters:
run_dir (str | pathlib.Path) – The run directory — journal, plan, records and analysis.
experiment (str) – What the bench calls the experiment; the run’s own name is used when it is not given.
- Returns:
The HTML.
- Raises:
ReportError – When the directory holds no run.
- Return type:
str
- plesty.server.services.run_report.write(run_dir: str | pathlib.Path, target: str | pathlib.Path, experiment: str = '') pathlib.Path
Compile the run and write it to target; returns the path written.
- Raises:
ReportError – When the run cannot be read, or the file cannot be written.
- Parameters:
run_dir (str | pathlib.Path)
target (str | pathlib.Path)
experiment (str)
- Return type:
pathlib.Path
- plesty.server.services.run_report.suggested_name(run_dir: str | pathlib.Path, experiment: str = '') str
A file name for the run’s report, findable by what it is a report of.
- Parameters:
run_dir (str | pathlib.Path)
experiment (str)
- Return type:
str