diff --git a/model_manager/utils/models/experiment_status.py b/model_manager/utils/models/experiment_status.py index 4325959..1fb70fa 100644 --- a/model_manager/utils/models/experiment_status.py +++ b/model_manager/utils/models/experiment_status.py @@ -18,11 +18,9 @@ class ExperimentStatus(StrEnum): ORCHESTRATOR_VALIDATION_ERROR: Error in the parameters validation. TRAINING_SUCCESS: Training completed successfully with model and metrics calculated. TRAINING_ERROR: Training failed due to data issues, model errors, or other exceptions. - FILE_DELETE_ERROR: Cleanup failed due to file system or MinIO errors. """ ORCHESTRATOR_VALIDATION_ERROR = 'ORCHESTRATOR_VALIDATION_ERROR' ORCHESTRATOR_WAITING_PROC = 'ORCHESTRATOR_WAITING_PROC' TRAINING_SUCCESS = 'TRAINING_SUCCESS' TRAINING_ERROR = 'TRAINING_ERROR' - FILE_DELETE_ERROR = 'FILE_DELETE_ERROR' diff --git a/tests/utils/models/test_experiment_status.py b/tests/utils/models/test_experiment_status.py index ea8bf02..42682d9 100644 --- a/tests/utils/models/test_experiment_status.py +++ b/tests/utils/models/test_experiment_status.py @@ -5,15 +5,15 @@ from model_manager.utils.models.experiment_status import ExperimentStatus def test_experiment_status_values(): """Test that all expected status values exist.""" + assert ExperimentStatus.ORCHESTRATOR_VALIDATION_ERROR == 'ORCHESTRATOR_VALIDATION_ERROR' assert ExperimentStatus.ORCHESTRATOR_WAITING_PROC == 'ORCHESTRATOR_WAITING_PROC' assert ExperimentStatus.TRAINING_SUCCESS == 'TRAINING_SUCCESS' assert ExperimentStatus.TRAINING_ERROR == 'TRAINING_ERROR' - assert ExperimentStatus.FILE_DELETE_ERROR == 'FILE_DELETE_ERROR' def test_experiment_status_count(): - """Test that enum has exactly 8 status values.""" - assert len(ExperimentStatus) == 5 + """Test that enum has exactly 4 status values.""" + assert len(ExperimentStatus) == 4 def test_experiment_status_is_string(): @@ -25,24 +25,25 @@ def test_experiment_status_is_string(): def test_experiment_status_membership(): """Test membership checks for status values.""" + assert 'ORCHESTRATOR_VALIDATION_ERROR' in [s.value for s in ExperimentStatus] assert 'ORCHESTRATOR_WAITING_PROC' in [s.value for s in ExperimentStatus] assert 'TRAINING_SUCCESS' in [s.value for s in ExperimentStatus] assert 'TRAINING_ERROR' in [s.value for s in ExperimentStatus] - assert 'FILE_DELETE_ERROR' in [s.value for s in ExperimentStatus] def test_experiment_status_iteration(): """Test that enum can be iterated.""" statuses = list(ExperimentStatus) - assert len(statuses) == 5 + assert len(statuses) == 4 + assert ExperimentStatus.ORCHESTRATOR_VALIDATION_ERROR in statuses assert ExperimentStatus.ORCHESTRATOR_WAITING_PROC in statuses assert ExperimentStatus.TRAINING_SUCCESS in statuses assert ExperimentStatus.TRAINING_ERROR in statuses - assert ExperimentStatus.FILE_DELETE_ERROR in statuses def test_experiment_status_comparison(): """Test that enum values can be compared with strings.""" + assert ExperimentStatus.ORCHESTRATOR_VALIDATION_ERROR == 'ORCHESTRATOR_VALIDATION_ERROR' assert ExperimentStatus.ORCHESTRATOR_WAITING_PROC == 'ORCHESTRATOR_WAITING_PROC' assert ExperimentStatus.TRAINING_SUCCESS == 'TRAINING_SUCCESS' assert ExperimentStatus.TRAINING_ERROR != 'TRAINING_SUCCESS' @@ -50,19 +51,25 @@ def test_experiment_status_comparison(): def test_experiment_status_access_by_name(): """Test accessing enum members by name.""" + assert ( + ExperimentStatus['ORCHESTRATOR_VALIDATION_ERROR'] + == ExperimentStatus.ORCHESTRATOR_VALIDATION_ERROR + ) assert ( ExperimentStatus['ORCHESTRATOR_WAITING_PROC'] == ExperimentStatus.ORCHESTRATOR_WAITING_PROC ) assert ExperimentStatus['TRAINING_SUCCESS'] == ExperimentStatus.TRAINING_SUCCESS assert ExperimentStatus['TRAINING_ERROR'] == ExperimentStatus.TRAINING_ERROR - assert ExperimentStatus['FILE_DELETE_ERROR'] == ExperimentStatus.FILE_DELETE_ERROR def test_experiment_status_access_by_value(): """Test accessing enum members by value.""" + assert ( + ExperimentStatus('ORCHESTRATOR_VALIDATION_ERROR') + == ExperimentStatus.ORCHESTRATOR_VALIDATION_ERROR + ) assert ( ExperimentStatus('ORCHESTRATOR_WAITING_PROC') == ExperimentStatus.ORCHESTRATOR_WAITING_PROC ) assert ExperimentStatus('TRAINING_SUCCESS') == ExperimentStatus.TRAINING_SUCCESS assert ExperimentStatus('TRAINING_ERROR') == ExperimentStatus.TRAINING_ERROR - assert ExperimentStatus('FILE_DELETE_ERROR') == ExperimentStatus.FILE_DELETE_ERROR diff --git a/tests/workflows/test_train_model.py b/tests/workflows/test_train_model.py index a3b4f54..23323d8 100644 --- a/tests/workflows/test_train_model.py +++ b/tests/workflows/test_train_model.py @@ -513,8 +513,8 @@ async def test_run_workflow_cleanup_error( mock_train_params, # validate_train_params None, # update status (ORCHESTRATOR_WAITING_PROC) train_result, # train_model + None, # update status (TRAINING_SUCCESS) RuntimeError('Cleanup failed'), # cleanup_resources fails - None, # update status (FILE_DELETE_ERROR) ] )