Overview
_fit_bypass_test_mode (the PYAUTO_TEST_MODE=2/3 sampler bypass) writes samples, summary and results but returns without self.paths.completed() — unlike start_resume_fit. A bypass-"completed" search is therefore never seen as complete, so re-running the same script re-bypasses every stage instead of taking result_via_completed_fit. This defeats the resume-representative purpose of PYAUTO_TEST_MODE_SAMPLES (#1378/#1381) and was found by the SLaM resume profiler (autolens_profiling#70), which carries a runtime stopgap.
Plan
- Call
self.paths.completed() before the return in _fit_bypass_test_mode (mirrors start_resume_fit; NullPaths/DatabasePaths no-op safely).
- Unit test: after a bypassed
fit(), paths.is_complete is true and a second fit() routes through result_via_completed_fit.
- Rider (deferred): remove the stopgap block in
autolens_profiling/pipeline_resume/slam_resume.py once the repo's current claim frees — the stopgap is a harmless no-op after this fix.
Detailed implementation plan
Work Classification
Library (PyAutoFit)
Branch Survey
| Repository |
Current Branch |
Dirty? |
| ./PyAutoFit |
main |
clean |
Suggested branch: feature/test-mode-bypass-completed
Implementation Steps
autofit/non_linear/search/abstract_search.py::_fit_bypass_test_mode — add self.paths.completed() immediately before return result (after model.unfreeze()).
- Test in
test_autofit/non_linear/ near existing test-mode bypass coverage: run a bypassed fit with DirectoryPaths into tmp, assert paths.is_complete; call fit() again and assert the completed-fit path is taken (e.g. monkeypatch start_resume_fit to raise / spy on result_via_completed_fit).
- Full
test_autofit/ suite.
Key Files
autofit/non_linear/search/abstract_search.py
test_autofit/non_linear/ (bypass tests)
Original Prompt
Click to expand starting prompt
Found during slam-resume-profiling (autolens_profiling#70, the test-mode epic's phase 3): in
@PyAutoFit autofit/non_linear/search/abstract_search.py, _fit_bypass_test_mode (the
PYAUTO_TEST_MODE=2/3 path) writes samples, summary and results but returns without calling
self.paths.completed() — unlike start_resume_fit, which marks completion before returning.
Consequence: a bypass-"completed" search is never seen as complete (paths.is_complete false), so
re-running the same script re-bypasses every stage instead of taking result_via_completed_fit.
This defeats the resume-representative purpose of PYAUTO_TEST_MODE_SAMPLES (PyAutoFit#1378/#1381):
the docstring promises "downstream code sees a complete result folder", and .completed is part of
a complete result folder.
Fix is one line — call self.paths.completed() before the return in _fit_bypass_test_mode
(NullPaths/DatabasePaths already no-op safely, matching the surrounding save calls). Add a unit test
asserting paths.is_complete after a bypassed fit, and that a second fit() routes through
result_via_completed_fit.
The autolens_profiling harness (pipeline_resume/slam_resume.py, _install_resume_timers) carries a
runtime patch applying exactly this marker as a stopgap — remove that patch block when this ships.
Overview
_fit_bypass_test_mode(thePYAUTO_TEST_MODE=2/3sampler bypass) writes samples, summary and results but returns withoutself.paths.completed()— unlikestart_resume_fit. A bypass-"completed" search is therefore never seen as complete, so re-running the same script re-bypasses every stage instead of takingresult_via_completed_fit. This defeats the resume-representative purpose ofPYAUTO_TEST_MODE_SAMPLES(#1378/#1381) and was found by the SLaM resume profiler (autolens_profiling#70), which carries a runtime stopgap.Plan
self.paths.completed()before the return in_fit_bypass_test_mode(mirrorsstart_resume_fit; NullPaths/DatabasePaths no-op safely).fit(),paths.is_completeis true and a secondfit()routes throughresult_via_completed_fit.autolens_profiling/pipeline_resume/slam_resume.pyonce the repo's current claim frees — the stopgap is a harmless no-op after this fix.Detailed implementation plan
Work Classification
Library (PyAutoFit)
Branch Survey
Suggested branch:
feature/test-mode-bypass-completedImplementation Steps
autofit/non_linear/search/abstract_search.py::_fit_bypass_test_mode— addself.paths.completed()immediately beforereturn result(aftermodel.unfreeze()).test_autofit/non_linear/near existing test-mode bypass coverage: run a bypassed fit withDirectoryPathsinto tmp, assertpaths.is_complete; callfit()again and assert the completed-fit path is taken (e.g. monkeypatchstart_resume_fitto raise / spy onresult_via_completed_fit).test_autofit/suite.Key Files
autofit/non_linear/search/abstract_search.pytest_autofit/non_linear/(bypass tests)Original Prompt
Click to expand starting prompt
Found during slam-resume-profiling (autolens_profiling#70, the test-mode epic's phase 3): in
@PyAutoFit
autofit/non_linear/search/abstract_search.py,_fit_bypass_test_mode(thePYAUTO_TEST_MODE=2/3path) writes samples, summary and results but returns without callingself.paths.completed()— unlikestart_resume_fit, which marks completion before returning.Consequence: a bypass-"completed" search is never seen as complete (
paths.is_completefalse), sore-running the same script re-bypasses every stage instead of taking
result_via_completed_fit.This defeats the resume-representative purpose of
PYAUTO_TEST_MODE_SAMPLES(PyAutoFit#1378/#1381):the docstring promises "downstream code sees a complete result folder", and
.completedis part ofa complete result folder.
Fix is one line — call
self.paths.completed()before the return in_fit_bypass_test_mode(NullPaths/DatabasePaths already no-op safely, matching the surrounding save calls). Add a unit test
asserting
paths.is_completeafter a bypassed fit, and that a secondfit()routes throughresult_via_completed_fit.The autolens_profiling harness (
pipeline_resume/slam_resume.py,_install_resume_timers) carries aruntime patch applying exactly this marker as a stopgap — remove that patch block when this ships.