Repository navigation
feat: per-fit status record, failure record and run-state vocabulary (hpc-campaign phase 1) - #1738
Merged
Merged
Conversation
hpc-campaign phase 1 (#1735). - autofit/non_linear/status/: states.py (RunState, FailureClass, Product: the single vocabulary), writer.py (StatusWriter: atomic <output_path>.status.json capped at 2 KB, append-only .status.jsonl history, .traceback.txt), probe.py (fail-soft resources: cgroup v2 memory.peak inside a job else getrusage, CPU seconds self+children, NVML only when importable and a GPU is allocated, CPU model, scheduler job from a generic SLURM_* env mapping), signals.py (SIGUSR1 -> checkpoint flush + timeout_pending; SIGTERM same then exit 143; main thread of the top-level process only, previous handlers restored, forked workers pass signals on unchanged), record.py (FitStatus lifecycle, cadence thread, status_recorded / status_notify hooks). - fit() runs inside status_recorded: an exception writes `failed` + failure_class + traceback and is re-raised unchanged. Hooks at start_resume_fit (running), FitContext.update (progress), _complete_fit (completed) and result_via_completed_fit (skipped, not a new attempt). - progress() for Nautilus, Dynesty, Emcee and BFGS/LBFGS. - general.yaml hpc.status (default true) and hpc.status_interval_s (60); hpc.status: false writes nothing and installs no handlers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016nhQ8N4RdvbZz9cstLYtNF
This was referenced Oct 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
hpc-campaign phase 1 (#1735). Every fit that outputs to disk now keeps a small status record beside its output folder, so a campaign of thousands of fits can be monitored and diagnosed without opening results:
<output_path>.status.json: current state, attempt, resources (peak memory, CPU seconds, GPU when allocated, CPU model, Slurm job fields) and, for Nautilus / Dynesty / Emcee / BFGS / LBFGS, progress and ETA. Written atomically, capped at 2 KB, refreshed everyhpc.status_interval_s(60 s)<output_path>.status.jsonl: append-only history; a resumed fit showsattempt: 2fit()writesstate: failed, afailure_classand<output_path>.traceback.txt, then re-raises unchanged--signal=B:USR1@<s>) flushes the checkpoint and writestimeout_pending; SIGTERM does the same then exits 143. Installed only in the main thread of the top-level process; previous handlers are restoredautofit/non_linear/status/states.pyis the single run-state / failure-class / product vocabulary; results-library imports ithpc.status: falsewrites nothing and installs no handlersThe files are siblings of the output folder, so they survive
output.remove_files.Merge order: after #1736 (results-library PR 0a). Both touch
abstract_search.pyand the Nautilus/dynesty search files; a test merge of this branch onto #1736 has no conflicts. Companion PRs: PyAutoLabs/PyAutoNerves#207 (site layer) and PyAutoLabs/autofit_workspace#179 (docs).API Changes
Additive. New package
autofit.non_linear.status(RunState,FailureClass,Product,StatusWriter,FitStatus,ResourceProbe). New config keyshpc.status(defaulttrue) andhpc.status_interval_s(default60).progress()added to Nautilus, Dynesty, Emcee and BFGS/LBFGS. Behaviour change: fits that output to disk now write the status files above; sethpc.status: falseto opt out.See full details below.
Test Plan
test_autofit/non_linear/status/test_fit_status.py+test_units.py(new): status written at start / cadence / completion; killed-and-resumed →attempt: 2; ≤2 KB; failure record + re-raise; SIGUSR1 →timeout_pending;hpc.status: falsechanges nothingtest_autofitsuite: 3,952 passed + the 3test_aggregate_csvtests that had clashed with a parallel run (/tmp/summary.csv) pass when run on their own (17/17)pyauto-heart smoke autofit autolens_teston the phase 1 worktree (PyAutoFit + PyAutoNerves + autofit_workspace branches together): 47 passed, 0 failedFull API Changes (for automation & release notes)
Added
autofit.non_linear.status.states—RunState,FailureClass,Productenums (shared vocabulary)autofit.non_linear.status.writer.StatusWriter(output_path)— atomic.status.json, append-only.status.jsonl,.traceback.txtautofit.non_linear.status.probe—ResourceProbe,job_from_env,gpu_allocated,peak_rss,cpu_seconds,cpu_model,gpuautofit.non_linear.status.record—FitStatuslifecycle (start,update,completed,skipped,failed,timeout_pending,close),status_recorded(search),status_notify(search, transition, *args),status_enabled(),status_interval_s()autofit.non_linear.status.signals— SIGUSR1 / SIGTERM handlersprogress(search_internal)on Nautilus, Dynesty, Emcee, BFGS / LBFGSconfig/general.yaml:hpc.status: true,hpc.status_interval_s: 60Changed behaviour
fit()runs insidestatus_recorded; hooks at resume (running),FitContext.update(progress),_complete_fit(completed) andresult_via_completed_fit(skipped, not a new attempt)Migration
hpc: status: falseingeneral.yaml.Refs #1735
🤖 Generated with Claude Code