Skip to content

fix: dedupe number_of_cores in Drawer for from_dict round-trip - #1270

Merged
Jammy2211 merged 1 commit into
mainfrom
feature/unpark-ellipse-scripts
May 15, 2026
Merged

Jammy2211 merged 1 commit into
mainfrom
feature/unpark-ellipse-scripts

Conversation

@Jammy2211

Copy link
Copy Markdown
Collaborator

Summary

Fix a TypeError in Drawer.__init__ when a saved Drawer search is reconstructed via autoconf.dictable.from_dict. The constructor hardcoded number_of_cores=1 in its super().__init__(...) call while also forwarding **kwargs; the saved search.json of a Drawer fit carries number_of_cores at the top level (the resolved value, always 1), which collided.

The fix pops number_of_cores from kwargs before forwarding to super(). Drawer is single-core only by design, so the saved value is always 1 and discarding it is safe.

Surfaced by the autogalaxy_workspace/scripts/ellipse/database.py aggregator example (unparked in the companion workspace PR). Before this fix, scraping any output directory containing a Drawer fit raised:

TypeError: AbstractMLE.__init__() got multiple values for keyword argument 'number_of_cores'

API Changes

None — internal bugfix only.

Test Plan

  • New regression test test__dict_round_trip_with_number_of_cores in test_autofit/non_linear/search/optimize/test_drawer.py round-trips a Drawer through to_dict / from_dict and asserts the resolved number_of_cores == 1.
  • Full PyAutoFit unit suite — 1243 passed, 1 skipped.
  • End-to-end verification: autogalaxy_workspace/scripts/ellipse/database.py now completes under PYAUTO_TEST_MODE=2, including the aggregator scrape of the fit_all Drawer outputs (was previously the failure point).
Full API Changes (for automation & release notes)

Removed

  • (none)

Added

  • (none)

Renamed

  • (none)

Changed Signature

  • (none)

Changed Behaviour

  • autofit.Drawer.__init__ — pops number_of_cores from **kwargs before forwarding to AbstractMLE.__init__. No effect on direct construction (users have never been able to override Drawer's single-core operation); only fixes the previously-broken from_dict round-trip.

Migration

None required — pure bugfix.

🤖 Generated with Claude Code

Drawer.__init__ hardcoded `number_of_cores=1` while also forwarding
`**kwargs` to super(). A round-tripped Drawer.search.json carries
`number_of_cores` at the top level (the resolved value), so
`from_dict(saved_dict)` crashed with:
  TypeError: AbstractMLE.__init__() got multiple values for keyword
  argument 'number_of_cores'

Pop `number_of_cores` from kwargs before forwarding. Drawer is
single-core only by design, so the saved value is always 1 and
discarding it is safe.

Surfaced by the autogalaxy_workspace `scripts/ellipse/database.py`
example, which scrapes Drawer fits via the aggregator.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@Jammy2211

Copy link
Copy Markdown
Collaborator Author

Workspace PR: PyAutoLabs/autogalaxy_workspace#73

@Jammy2211

Copy link
Copy Markdown
Collaborator Author

Workspace PR (PyAutoBuild config): PyAutoLabs/PyAutoHands#89

@Jammy2211
Jammy2211 merged commit 52d5c10 into main May 15, 2026
4 checks passed
@Jammy2211
Jammy2211 deleted the feature/unpark-ellipse-scripts branch May 15, 2026 13:10
@Jammy2211 Jammy2211 removed the pending-release PR queued for the next release build label Sep 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant