quantlab.runs.directory#
Run directories: the mechanism every run type of quantlab is written and read through.
A run is a directory. It holds its files and, written last, run.json,
the record that makes the directory a run: a directory without it is not a
run, so a crash can never leave one that opens. Every run.json starts
with the same header:
format_version: one version shared by every run type (FORMAT_VERSION); a run written in another version is refused with a message to re-run or retrain it, never read wrongly;kind: what the run is, which decides the typeopen_runreturns;written_at: when the record was written, an ISO 8601 UTC timestamp.
The rest of the record belongs to the run type. Paths inside it are relative
to the run’s directory (relative_name / recorded_path), so a run copied
elsewhere still opens. A run whose files are written at once can be
written through staged: into a hidden sibling first, renamed into place
when complete.
The run types are quantlab.runs.trained_run.TrainedRun (kinds
"model", "ensemble", "walk_forward") and
quantlab.runs.backtest_run.BacktestRun (kinds "run", "run_cv",
"run_weights", "fold"). open_run reads any run
and returns its type, which is imported only when a run of that kind is
opened.
This module imports no quantlab module outside quantlab.utils; the run
types in KINDS are named by import path and imported only by
open_run.
Examples#
>>> run = open_run("models/MyHead_trial_20240601_120000_000000")
>>> type(run).__name__, run.kind
('TrainedRun', 'model')
Functions
Read the run at |
|
Return the |
|
Return where the |
|
Return the path a |
|
Return |
|
Return the run directory of |
|
Yield a hidden staging directory that becomes |
|
Write |