Repository navigation
feat: results-library phase 0a — artefact integrity - #1736
Merged
Merged
Conversation
- zip_directory writes <out>.zip.<pid>.tmp and os.replace-s it into place, so a result zip is complete or absent; .png/.fits/.hdf/.hdf5/.h5 members are ZIP_STORED, text DEFLATED (also used by preserve_in_zip appends). - restore() is non-destructive: a complete output directory is left untouched, a zip is extracted into a temporary sibling and renamed into place (safe for concurrent restorers), the zip is deleted only when owned (remove_files and an identifier-keyed path), and a BadZipFile zip is renamed <hash>.zip.corrupt_<utc> and the search continues as not complete. - New read-only open_result() (output directory or zipfile.Path, never extracts). - DirectoryPaths.is_complete reads a zipped result: .completed member + clean testzip(), cached per path by (size, mtime). - Checkpointer.probe / probe_hdf5 / quarantine_search_internal / resume_state_usable: Nautilus (h5py probe) and dynesty (savestate restore probe) move an unreadable search_internal/ to search_internal.failed_<utc>/ and start fresh; Nautilus retries once from scratch on a LinAlgError when resumed. - Timer writes files/.start_time and files/.time atomically behind has_timer, reading the legacy files/search_internal/ location as a fallback. Refs #1734 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016nhQ8N4RdvbZz9cstLYtNF
This was referenced Oct 29, 2026
Merged
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
Results-library phase 0, PR 0a of 2 (#1734), shared with hpc-campaign. Makes result artefacts complete-or-absent and stops one bad file from breaking every rerun:
restore()no longer deletes the output directory or the zip it did not create; it extracts into a temp sibling and renames (safe for concurrent restorers), and a corrupt zip is renamed<hash>.zip.corrupt_<utc>and the fit carries on as "not complete".completedmember and passestestzip()(cached per path)search_internal.failed_<utc>/and the search starts fresh, instead of crashing on resumefiles/and are written atomicallyPR 0b (honest reads in the aggregator / AggregateCSV) follows as a stacked PR. hpc-campaign phase 1 (#1735) merges after this one; both touch
abstract_search.pyand merge cleanly.API Changes
Additive, plus safer behaviour of existing calls.
restore()no longer deletes a zip it does not own and no longer re-raisesBadZipFile;is_completenow recognises zipped results. New read-onlypaths.open_result(). Timer reads fall back to the legacy location, so old output still loads.See full details below.
Test Plan
test_autofit/non_linear/paths/test_artefact_integrity.py(new): killed-mid-zip resumes; two processes restore one zip concurrently and both read it; truncated-HDF5 and poisoned-dill checkpoints are quarantined and start fresh;.png/.fits/.hdf5members areZIP_STOREDtest_autofitsuite: 3,953 passed, 2 skipped, 1 xfailedpyauto-heart smoke autofit autolens_test: 47 passed, 0 failed (8 autofit scripts + 2 notebooks, 37 autolens_workspace_test scripts)Full API Changes (for automation & release notes)
Added
AbstractPaths.open_result()— read-only view of a finished result: the output directory, or azipfile.Pathinto the zip; never extractsautofit.non_linear.paths.abstract.zip_is_complete(zip_path)—.completedmember + cleantestzip()Checkpointer.probe(paths);checkpoint.probe_hdf5(path),checkpoint.quarantine_search_internal(paths, reason=None),checkpoint.resume_state_usable(paths, resume_state)autofit.tools.util.compress_type_for(file_path)—ZIP_STOREDfor.png/.fits/.hdf/.hdf5/.h5,ZIP_DEFLATEDotherwiseTimer(timer_path, legacy_path=None)— optional legacy read locationChanged behaviour
zip_directorywrites<out>.zip.<pid>.tmpthenos.replacerestore()leaves a complete output directory untouched; removes the zip only whenremove_filesis set and the path is identifier-keyed;BadZipFile→ zip renamed<hash>.zip.corrupt_<utc>, warning logged, result treated as not completeDirectoryPaths.is_completeis true for a zip with a.completedmemberLinAlgErrorwhen resumedfiles/.start_timeandfiles/.timeMigration
restore()raisingBadZipFileshould checkis_completeinstead.Refs #1734
🤖 Generated with Claude Code