fix: construct retrained Solution with valid fields - #194
Open
Tyagiquamar wants to merge 1 commit into
Open
Conversation
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.
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! |
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.
Problem
Retraining mode (
--is-retrain, exposed throughmain(..., is_retrain=True)->retrain_model) always crashes with: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
Solutiondataclass identifier field was renamed fromiterationtosolution_idduring the workflow rewrite (#161), butretrain.pywas never updated. The constructor call at the end ofretrain_modelstill passesiteration=0, which is now an invalid keyword argument. Becauseretrain_modelwraps everything in a catch-allexcept Exception, this surfaces as a genericRetrainingErrorafter all expensive work has completed.Fix
Construct the returned
Solutionwith the current required fields (solution_id=0) inplexe/retrain.py.Testing
tests/unit/test_retrain.pyrunsretrain_modelend-to-end against a fabricated xgboost model package with a mocked training runner (no Spark or LLM keys needed). On main it fails withTypeError ... unexpected keyword argument 'iteration'; with this fix it passes.python -m pytest tests/unit -q -n 2: 107 passed, 15 skippedruff checkandblack --check: clean on changed files