SIENTIAPDE-1646

Refactor MLFlow retraining logic to always use retrain method

- Removed the conditional logic for full retraining, ensuring the `retrain` method is always called.
- Updated the documentation in the `retrain_model` method to reflect the changes in retraining flow.
- Adjusted tests to verify that the `retrain` method is invoked correctly, while ensuring `train` is not called when the full retrain flag is set.
This commit is contained in:
vitor-aignosi
2026-05-07 09:03:33 -03:00
parent 424be007ef
commit aaf647efdf
2 changed files with 10 additions and 19 deletions

View File

@@ -477,7 +477,7 @@ async def test_retrain_model_success_with_payload_data(
@patch('laborious.activities.mlflow.tempfile.mkdtemp')
@patch('laborious.activities.mlflow.rmtree')
@patch('laborious.activities.mlflow.to_datetime')
async def test_retrain_model_success_full_retrain_branch(
async def test_retrain_model_always_uses_retrain_even_with_full_retrain_flag(
mock_to_datetime, mock_rmtree, mock_mkdtemp, mock_log_artifact, mlflow
):
mock_mkdtemp.return_value = 'tmp'
@@ -510,7 +510,8 @@ async def test_retrain_model_success_full_retrain_branch(
}
)
wrapper.train.assert_called_once()
wrapper.retrain.assert_called_once()
wrapper.train.assert_not_called()
assert response['success'] is True