SIENTIAPDE-1241: Refactor: Improve documentation, exception handling, and configuration in model manager. This commit enhances clarity and robustness by adding detailed docstrings to methods, standardizing exception handling with custom types, and simplifying MLflow configuration.

This commit is contained in:
Bruno Domingues
2025-10-22 21:48:12 -03:00
parent 758ffb10b6
commit 94697215aa
8 changed files with 84 additions and 42 deletions

View File

@@ -14,6 +14,7 @@ class ExperimentStatus(str, Enum):
to maintain compatibility with existing database records and monitoring systems.
Attributes:
ORCHESTRATOR_VALIDATION_ERROR: Error in the parameters validation.
MAGE_WAITING_PROC: Initial status indicating experiment is registered and waiting for processing.
TRAINING_SUCCESS: Training completed successfully with model and metrics calculated.
TRAINING_ERROR: Training failed due to data issues, model errors, or other exceptions.

View File

@@ -78,14 +78,6 @@ class TrainModelParams:
ValueError: If any required field is missing or None
TypeError: If any field has an incorrect type
KeyError: If any required key is missing from the dictionary
Example:
>>> input_data = {
... 'variable_columns': ['var1', 'var2'],
... 'lag_train': 5,
... # ... other fields
... }
>>> params = TrainModelParams.from_dict(input_data)
"""
return cls(
variable_columns=cls._check_none(
@@ -179,10 +171,6 @@ class TrainModelParams:
Raises:
ValueError: If any business rule is violated
Example:
>>> params = TrainModelParams.from_dict(data)
>>> params.validate_business_rules() # Raises ValueError if invalid
"""
# Validate train_size range (10-100%)
if not 10 <= self.train_size <= 100: