Skip to content

fix: construct retrained Solution with valid fields - #194

Open
Tyagiquamar wants to merge 1 commit into
plexe-ai:mainfrom
Tyagiquamar:fix/retrain-solution-construction
Open

fix: construct retrained Solution with valid fields#194
Tyagiquamar wants to merge 1 commit into
plexe-ai:mainfrom
Tyagiquamar:fix/retrain-solution-construction

Conversation

@Tyagiquamar

Copy link
Copy Markdown

Problem

Retraining mode (--is-retrain, exposed through main(..., is_retrain=True) -> retrain_model) always crashes with:

TypeError: Solution.__init__() got an unexpected keyword argument 'iteration'

at the very end of the run - after the model has already been fully trained and packaged - so users lose the entire run.

Root cause

The Solution dataclass identifier field was renamed from iteration to solution_id during the workflow rewrite (#161), but retrain.py was never updated. The constructor call at the end of retrain_model still passes iteration=0, which is now an invalid keyword argument. Because retrain_model wraps everything in a catch-all except Exception, this surfaces as a generic RetrainingError after all expensive work has completed.

Fix

Construct the returned Solution with the current required fields (solution_id=0) in plexe/retrain.py.

Testing

  • New test tests/unit/test_retrain.py runs retrain_model end-to-end against a fabricated xgboost model package with a mocked training runner (no Spark or LLM keys needed). On main it fails with TypeError ... unexpected keyword argument 'iteration'; with this fix it passes.
  • python -m pytest tests/unit -q -n 2: 107 passed, 15 skipped
  • ruff check and black --check: clean on changed files

retrain_model passed iteration=0 to Solution, but the dataclass field
was renamed to solution_id in the workflow rewrite (plexe-ai#161), so every
retraining job crashed with TypeError after training had already
completed and the artifacts were built. Construct the Solution with the
current required fields instead.
@Tyagiquamar

Copy link
Copy Markdown
Author

Hi @marcellodebernardi, gentle review ping when you have some bandwidth. #194 and #193 are both small focused bug fixes with regression tests and have been ready since Aug 25. Happy to address any feedback. Thanks!

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