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 assembles a RunRecord via
build_record and writes it + the report via write_record_and_report once the EvalReport
is ready (the one-shot save_and_report does both), so a host gets the saved JSON + the HTML
report for free — no manual wiring. The same record is reused for the optional EvalForge upload, so
the saved file and the uploaded record share one timestamp / dedup key. 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§
- build_
record - Assemble a
RunRecordfrom a finishedreportplus the run identity, stamping it with a singlenowtimestamp (so a record built once can be written to disk AND uploaded sharing the same timestamp / dedup key). - 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. - write_
record_ and_ report - Write
recordintoresults_dir(viasave_record) and (re)generatereport.htmlover every run in that directory, returning the written JSON path. Public so a host can persist a pre-builtRunRecord(e.g. one frombuild_record) without re-assembling it.