Expand description
Automatic persistence of an eval run: write it as a JSON RunRecord into a results directory
and (re)generate the self-contained report.html over every run saved there.
This is the engine behind RunMeta::persist_to: when a run carries a
Persist target, run_eval_with_meta calls save_and_report once
the EvalReport is assembled, so a host gets the saved JSON + the HTML report for free — no manual
wiring. The filename pattern ({slug(model)}_{timestamp_file}.json), the pretty-printed JSON, and
the “warn, don’t fail” posture all match the convention hosts used before this was built in, so
existing results/*.json and report.html stay shape-compatible.
Structs§
- Persist
- Where and how to persist a run, attached to a
RunMetaviaRunMeta::persist_to. When present on the meta passed to a run, the runner writes{slug(model)}_{timestamp_file}.jsonintoresults_dirand regeneratesresults_dir/report.html.
Functions§
- save_
and_ report - Build a
RunRecordfromreport+ thePersisttarget, write it as{slug(model)}_{timestamp_file}.jsonunderpersist.results_dir, then (re)generatereport.htmlover every run in that directory. Returns the written JSON path. - save_
record - Write
recordas pretty JSON to{results_dir}/{slug(model)}_{timestamp_file}.json, creating the directory if needed, and return the written path. Public so a host can persist a hand-builtRunRecordwithout driving a full run through the runner. - slug
- Sanitize a model label into a filesystem-safe slug for the results filename: keep
[A-Za-z0-9._-], replace every other char with-, collapse runs of-, trim leading/trailing-, and fall back to"model"if nothing is left.