Repository navigation
Description
Overview
ParallelEPOptimiser has never been used, adds complexity, and if it is ever wanted it can be restored from git history (human decision 2026-09-11, after #1608 / #1610). It is dead code already: not exported from autofit, autofit.graphical or the EP package (reachable only by deep import); its only test helper, _test_parallel_laplace in test_autofit/graphical/regression/test_linear_regression.py, is underscore-prefixed and never collected; and it is recorded as crashing at completion when paths=None (#1332 F3). It is EP's own opt-in process pool across factors (fork_context().Pool(n_cores - 1) + starmap(factor_step, …)), which shares the dead-worker hang fixed for Nautilus in #1610 and the JAX-in-a-forked-child deadlock of #1442. The ruling of 2026-09-09 is that EP never combines with Python multiprocessing, so the class contradicts the ruling by existing.
Plan
- Delete the
ParallelEPOptimiserclass and the now-unusedfork_contextimport from the EP optimiser module. - Delete the never-collected
_test_parallel_laplacehelper and its import. - Rewrite the F3 comments in the diagnostics tests so they describe
EPOptimiser.runonly. - Remove README section 7 (Parallel EP), renumber the lowering contract from §8 to §7, and fix every cross-reference to those section numbers (README, tests,
AGENTS.md's EP seam rule). - Record the removal in the PR's API Changes as Removed (internal, never exported).
- Separately, update the PyAutoMemory concept page line that describes the class (research: EP review phase 1 — statistics audit of autofit/graphical #1332 F3) to say it was removed here.
Detailed implementation plan
Affected Repositories
- PyAutoFit (primary)
- PyAutoMemory (one wiki line; separate ledger commit, not a PR of this issue)
Work Classification
Library
Branch Survey
| Repository | Current Branch | Dirty? |
|---|---|---|
| ./PyAutoFit | main (915acd5f, #1610 merged) |
clean |
Suggested branch: feature/remove-parallel-ep-optimiser
Implementation Steps
autofit/graphical/expectation_propagation/optimiser.py— deleteclass ParallelEPOptimiser(EPOptimiser)(from itsclassline to the end of itsrunmethod, including the docstring note fix(ep): never drive a factor search through a multiprocessing pool; fail fast on a dead Nautilus worker (#1608) #1610 added). Removefrom autofit.non_linear.parallel import fork_contextif nothing else in the module uses it (grep first).test_autofit/graphical/regression/test_linear_regression.py— delete_test_parallel_laplaceand theParallelEPOptimiserimport.test_autofit/graphical/functionality/test_diagnostics.py(~lines 178–202) — rewrite the comments that referenceParallelEPOptimiser/ F3 so they describe theEPOptimiser.runguards they actually exercise; keep the test behaviour identical.autofit/graphical/README.md— delete "## 7. Parallel EP —ParallelEPOptimiser"; renumber "## 8. The lowering contract" to 7 and fix every§7/§8/ "§1–§7" cross-reference in the README, intest_autofit/graphical/and inAGENTS.md(the EP seam rule names "§8").grep -rn ParallelEPOptimiser autofit test_autofit docsmust return nothing.- Tests:
python -m pytest test_autofit/graphical -qserially (baseline 281 passed after fix(ep): never drive a factor search through a multiprocessing pool; fail fast on a dead Nautilus worker (#1608) #1610; expect the same count, since the deleted helper was never collected), then the full suite. - PR: API Changes → Removed:
autofit.graphical.expectation_propagation.optimiser.ParallelEPOptimiser(internal, never exported).
Key Files
autofit/graphical/expectation_propagation/optimiser.py— the class.autofit/graphical/README.md— §7 / §8.test_autofit/graphical/regression/test_linear_regression.py,test_autofit/graphical/functionality/test_diagnostics.py— references.AGENTS.md— the EP seam rule's§8pointer.PyAutoMemory/wiki/methods/concepts/expectation-propagation.md— the F3 line.
Original Prompt
Click to expand starting prompt
PyAutoMind draft/refactor/autofit/remove_parallelepoptimiser_and_its_tests.md, filed 2026-09-11 by /intake from the human's request: "removing ParallelEPOptimiser does not seem crazy — we've never used it and it adds complexity … even if it had use we could add it back in".
Activity
Merge pull request #1612 from PyAutoLabs/feature/remove-parallel-ep-o…
Jammy2211 commentedon Sep 12, 2026
Shipped
54f464d9), CI green on every leg (unittest 3.12 / 3.13 / nojax, docs-build).ParallelEPOptimiserdeleted fromautofit/graphical/expectation_propagation/optimiser.pyalong with its never-collected_test_parallel_laplacehelper; README §7 (Parallel EP) removed and the lowering contract renumbered §8 → §7 with every cross-reference updated; the diagnostics end-of-run-guards test reworded; unusedmultiprocessingimport dropped. Net −211 lines, no public API change.wiki/methods/concepts/expectation-propagation.md, commit0cdede9on main).pending-releasestays until a release publishes it).Mind record:
PyAutoMind/complete/2026/09/remove-parallel-ep-optimiser.md.Generated by Claude Code