Rigorous.RunRegistry#
Rigorous.RunRegistry#
Disk-side breadcrumbs for rigorous optimization runs.
Why this exists#
A rigorous optimization can run for hours. Once launched (especially
via compare_optimization_paths with monitor=False), the parent
Python kernel may be busy and unable to answer “what is running right
now?” from outside. External observers (a second VS Code session,
an AI assistant, a shell) need an out-of-band way to find live runs
without parsing process trees or guessing folder names.
The registry solves this by writing two artifacts:
A per-run
RUN_MANIFEST.jsoninside eachanalysis_folder(and, once known, inside the legacywork_foldertoo), recording method / niter / pid / start time / paths.An append-only
~/.molass/runs.jsonlglobal registry — one line per run start. Cheap to scan; never rewritten.
Both files are best-effort: any I/O error is swallowed so the optimizer itself never fails because of bookkeeping.
Public helpers#
write_run_manifest()— drop a manifest at run startupdate_run_manifest()— merge fields into an existing manifestread_manifest()— read a single manifestlocate_recent_runs()— list recently-started runs
- write_run_manifest(folder, **fields)#
Write
RUN_MANIFEST.jsonintofolderand append a registry line.All errors are swallowed. Returns the manifest dict on success,
Noneon failure.- Parameters:
folder (str) – Absolute path of the folder to drop the manifest into. Must already exist.
**fields – Arbitrary JSON-serializable keys merged into the manifest. Common keys:
method,niter,in_process,monitor,analysis_folder,role(‘analysis’ or ‘work’).
- update_run_manifest(folder, **fields)#
Merge
fieldsinto an existing manifest infolder.Creates the file if missing. Errors swallowed.
- read_manifest(folder)#
Return the manifest dict in
folder, orNoneif absent / unreadable.
- locate_recent_runs(since_minutes=60, registry_path=None)#
Return a list of recently-started runs (newest first).
Reads the global registry at
~/.molass/runs.jsonland filters by start time. Each entry is augmented withexists(folder still on disk) andmanifest(the live manifest dict, if readable — may contain status fields likesubprocess_returncodewritten later).