Commit Graph

129 Commits

Author SHA1 Message Date
ada3515688 SIENTIAPDE-2226: Assign DataFrame before pytest.raises in test
- Build the DataFrame outside the `pytest.raises` block so only the
  call under test can raise the expected ValueError.
2026-10-27 13:37:51 -03:00
3266d34620 SIENTIAPDE-2226: Add plugin store e2e docs and cover repo edge cases
- Document PluginStore wiring e2e scenarios (4.1.1-4.1.5) covering env
  config, explicit branch, missing model, bad repo and bad credentials.
- Add unit tests for DataManagerRepository date parsing, timestamp
  dropping, numeric coercion and timezone handling to keep coverage at
  100%.
- Mark the cleanup guard in TrainModel as `no branch`, since the false
  branch always exits through the re-raise.
2026-10-27 12:22:14 -03:00
34eaa01ca7 SIENTIAPDE-2226: Stop installing runtime in worker; unpin requirements
- The sientia-module entrypoint now merges requirements.txt with the
  Plugin Store runtime and installs both before boot (SIENTIAPDE-2223),
  so the worker no longer calls install_runtime or runs the loaded
  package version guard.
- Leave runtime libs unpinned in requirements files so the runtime
  version wins; cap sqlalchemy<2.1 and evidently<0.7 for compatibility.
- Update README, CLAUDE.md and worker tests to match.
2026-10-27 10:43:41 -03:00
PedroHMCosme
52f9f2724b Merge remote-tracking branch 'origin/main' into fix/SIENTIAPDE-2215 2026-10-23 11:37:59 -03:00
PedroHMCosme
dfbdd4b605 fix(worker): set app_up only after the runtime version guard (SIENTIAPDE-2214)
The probes only check app_up, which was set to 1 when the metrics server started,
before install_runtime. A pod that would fail the guard could turn Ready first, so a
rollout would remove the old pod. app_up now goes to 1 right after the guard.

Also: copy sys.modules keys before iterating, raise the sientia_model floor to the
runtime's >=0.14.0, pin the same runtime versions in requirements-local.txt, test
that the snapshot is taken before the install and the real importlib.metadata path,
and document the boot failure in README and CLAUDE.md.
2026-10-22 12:17:12 -03:00
PedroHMCosme
0f5e4a5cef fix(worker): pin the runtime versions and refuse to boot when install_runtime swaps an imported package (SIENTIAPDE-2214)
Replaces the re-exec. requirements.txt now pins the union of the basic and xgboost
runtime libraries, so install_runtime has nothing to change in the packages the worker
already imported. If a runtime pin changes and requirements.txt is not updated, the
worker logs which packages changed and exits before starting the workers.

test_main_entrypoint assigned worker.main = AsyncMock() without restoring it, so every
later test of main() ran the mock; it now uses patch.object.
2026-10-22 11:34:04 -03:00
PedroHMCosme
9fa1430d75 fix(metrics): name the wrapper mock correctly and document NaN r2 with one valid pair (SIENTIAPDE-2215) 2026-10-22 10:57:53 -03:00
PedroHMCosme
fcb9bb263b test(metrics): build the metadata mock outside pytest.raises (SIENTIAPDE-2215) 2026-10-22 10:34:00 -03:00
PedroHMCosme
959a430314 test(metrics): compare metric floats with pytest.approx (SIENTIAPDE-2215) 2026-10-21 09:43:49 -03:00
PedroHMCosme
8c81aa68bb refactor(metrics): warn with the remaining count and document NaN pairs (SIENTIAPDE-2215) 2026-10-21 09:11:40 -03:00
PedroHMCosme
9c05871fcf fix(metrics): ignore NaN target/prediction pairs in validation metrics (SIENTIAPDE-2215) 2026-10-20 22:17:57 -03:00
PedroHMCosme
262ba8d658 docs(worker): document SIENTIA_RUNTIME_READY, log the skipped install, test install failure (SIENTIAPDE-2214)
From the code-review-python pass on #34:
- README, CLAUDE.md and the module docstring: the worker re-executes
  itself after install_runtime, and SIENTIA_RUNTIME_READY is internal;
  setting it in .env/the chart would skip the install silently.
- "Installing runtime" is now logged only on the pass that installs; the
  re-executed pass logs that the install was skipped.
- The ponytail comment notes that the install success metrics are lost
  to the exec.
- New test: a failed install propagates without setting the flag or
  calling os.execv (locks the install -> flag -> exec order).
2026-10-20 16:30:23 -03:00
PedroHMCosme
0c9c5f300b fix(worker): re-exec after install_runtime so imports match the runtime (SIENTIAPDE-2214)
The worker imports sklearn (metrics, evidently) before
PluginStore.install_runtime replaces it on disk with the runtime's pinned
version, the same order that breaks every sklearn prediction in laborious.
After installing the runtime, the worker now replaces its process once
(SIENTIA_RUNTIME_READY=1 skips the second install), so every module is
loaded from the runtime's packages.
2026-10-20 15:40:38 -03:00
PedroHMCosme
37f16f34ff SIENTIAPDE-2201: fix: keep the timestamp column in train/test data CSVs
generate_report wrote train_data.csv and test_data.csv with index=False, which
dropped the UTC time index. laborious drift reads test_data.csv from MLflow as
its reference and needs a timestamp column; without it, every model trained here
drifted against the first 30% of its own target window. Both CSVs now write the
index as timestamp. If a column already has that name, the CSV is written as
before and a warning is logged, so training never fails over drift.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 10:09:06 -03:00
4133e200f7 SIENTIAPDE-1645: Remove validate.sh script, add jsonschema dependency, and improve test code readability 2026-08-05 11:23:22 -03:00
2c63414770 SIENTIAPDE-1645: Expose detailed model training information via a new Prometheus gauge. This gauge, sientia_training_info, records metadata such as dataset sizes, feature count, and evaluation metrics (MSE, MAE, R2) along with the training run's timestamp. 2026-06-18 09:56:30 -03:00
fe8a9384ba SIENTIAPDE-1645: Rename Prometheus 'sientia_app_up' metric to 'app_up' and update test assertion. 2026-06-17 12:26:25 -03:00
76f926a8ab SIENTIAPDE-1645: Add comprehensive model training observability metrics and Grafana dashboard. 2026-06-17 10:34:56 -03:00
78167f7a44 fix: downgrade sientia_do version and update CSV saving logic
- Downgraded `sientia_do` version to 1.11.0 in `requirements.txt` to address compatibility issues.
- Updated `data_manager_repository.py` to save training and test data CSVs using float-cast versions of the data, ensuring consistency in the saved outputs.
- Enhanced test coverage in `test_data_manager_repository.py` to verify the presence of the target alias in the generated CSV files.
2026-05-05 16:26:47 -03:00
d1f9394879 feat: enhance E2E testing setup and model reporting
- Added a new fixture to manage runtime report artifacts in a writable temp directory during E2E tests, addressing permission issues in local CI/dev environments.
- Updated `conftest.py` to include a requirements.txt file in the model packaging path for training activities.
- Refactored existing fixtures to use `pytest.fixture` instead of `pytest_asyncio.fixture` for better compatibility.
- Enhanced the `Reports` class to include a target alias for report metrics, ensuring compatibility with Evidently's reporting requirements.
- Introduced new test scenarios to validate the handling of missing and whitespace-only `date_column` inputs in the training workflow.

These changes improve the robustness of the E2E testing framework and enhance the clarity of model reporting metrics.
2026-05-05 10:59:51 -03:00
ba9eb3d7c7 feat: require date_column in training parameters and update documentation
- Made `date_column` a required field in `TrainModelParams`, ensuring it must be present in the input data.
- Updated related documentation in `input-sample.md`, `README.md`, and various test scenarios to reflect the change in requirement.
- Adjusted the handling of `date_format` to default to `yyyy-MM-dd HH:mm:ss` if omitted, enhancing usability.
- Refined test scenarios to include new examples and ensure compliance with the updated parameter structure.

These changes improve the robustness of the model training workflow and clarify the expectations for input data.
2026-05-05 08:35:12 -03:00
31e95cbdf8 feat: log regression metrics as parameters in Training class
- Added a method to persist computed regression metrics (MSE, MAE, R²) as MLflow parameters during model training, enhancing model evaluation and tracking.
- Updated the Training class to log the equation path if available, improving artifact management.
2026-04-17 10:52:32 -03:00
c0bef2d688 feat: update values.yaml and refactor cleanup paths
- Changed project name in values.yaml from "sientia-dataops-model-manager" to "sientia-model-manager".
- Added new environment variables for GitHub repository and branch configuration.
- Refactored cleanup paths to use a centralized REPORTS_TEMP_DIR constant for consistency.
- Updated runtime configurations and adjusted volume mounts for better resource management.
- Enabled SSH access for the model manager and disabled Grafana dashboard creation.
- Updated tests to reflect changes in directory paths and environment variable usage.
2026-04-09 16:37:36 -03:00
526edcb50e feat: update training workflow and repository management
- Replaced synchronous MinIO repository calls with asynchronous counterparts in the Training class for improved performance.
- Enhanced logging throughout the training process to provide better insights into model metadata loading, parameter validation, and training execution.
- Updated the train_test_split function to enforce DataFrame input type, ensuring consistency in data handling.
- Removed the deprecated model_repository.py file to streamline the codebase.
- Adjusted cleanup schedule logic to improve error handling and logging during schedule reconciliation.
- Updated tests to reflect changes in the training workflow and repository interactions.
2026-04-09 12:09:52 -03:00
0ae03b246f feat: update environment configuration and remove deprecated model serving
- Modified `.env.example` to set local defaults for PostgreSQL, MLflow, and MinIO configurations.
- Added MongoDB configuration parameters to the environment setup.
- Updated `README.md` to reflect changes in workflow input parameters and task queue naming conventions.
- Removed the `ModelServing` class to streamline the codebase, as it was deemed unnecessary.
- Adjusted `connectors_config.py` to align with new environment variable names and improve clarity.
- Updated tests to reflect changes in configuration handling and removed tests related to the deleted `ModelServing` class.
2026-04-07 16:58:50 -03:00
c5cd382350 feat: enhance configuration and scheduling for cleanup processes
- Updated `.env.example` to include new environment variables for MinIO and PyPI configuration.
- Refactored `create_cleanup_schedule` to utilize runtime-specific task queues and improve schedule reconciliation logic.
- Enhanced `Activities` class to require a default bucket in MinIO configuration.
- Adjusted `requirements.txt` to specify version for `evidently`.
- Updated tests to reflect changes in schedule creation and configuration handling.
2026-04-07 12:57:29 -03:00
09ee92f100 feat: enhance configuration and error handling in project setup
- Added new ignore rule for Ruff to allow temporary paths in tests.
- Introduced MyPy overrides for specific modules to ignore errors.
- Refactored `Cleanup` and `ExperimentTracking` classes to remove async keywords from methods, improving consistency in method signatures.
- Updated `Training` class methods to handle synchronous operations, enhancing performance and clarity.
- Adjusted `requirements.txt` to remove unnecessary Git dependency, streamlining project setup.
2026-04-07 10:25:17 -03:00
6b1df7c3a7 feat: enhance training and experiment tracking functionality
- Updated `Activities` class to improve garbage collection handling.
- Enhanced error messaging in `ExperimentTracking` for better clarity on update failures.
- Refactored `Training` class to streamline exception handling and improve type hints.
- Introduced new methods in `TrainModelParams` for better handling of experiment run IDs and model metadata.
- Added functionality to extract model equations in `DataManagerRepository` for linear regression models.
2026-04-06 15:05:57 -03:00
d2bb588739 Merge branch 'main' into release/SIENTIAPDE-1645 2026-04-06 08:34:15 -03:00
cce350bfb1 SIENTIAPDE-1717: Remove FILE_DELETE_ERROR from ExperimentStatus enum and related tests. 2026-03-30 14:33:19 -03:00
f5eb8d1e5b SIENTIAPDE-1717: Remove list_bucket_objects method from StorageRepository and its associated test. 2026-03-30 14:18:14 -03:00
7a0961f29d SIENTIAPDE-1717: Remove MinIO cleanup functionality and associated components. This change streamlines the cleanup workflow to focus solely on local temporary directories, removes the ModelTrainingError exception, and updates related configurations, documentation, and tests. 2026-03-30 14:14:10 -03:00
342a02d6f7 feat: enhance training workflow with model metadata loading and refactor data handling
- Introduced a new activity to load model metadata from the model store.
- Refactored training logic to utilize new model metadata and improved parameter handling.
- Updated the `TrainModelParams` class to include additional fields for model configuration.
- Replaced deprecated utility functions with a custom train-test split implementation.
- Removed unused utility functions and cleaned up the data manager repository.
- Adjusted experiment tracking to include model-specific metadata in notifications.
2026-03-24 14:39:28 -03:00
cf5111e520 feat: integrate PluginStore and MinIO repository into model manager activities
- Added PluginStore integration for model management.
- Replaced StorageRepository with MinIORepository in Activities, Cleanup, and Training classes.
- Updated training logic to handle validation files and improved data management.
- Enhanced configuration for MinIO and PluginStore in connectors.
- Removed deprecated model repository and storage repository files.
- Updated environment variable handling for new configurations.
2026-03-11 17:35:05 -03:00
41c4490cad SIENTIAPDE-1579: Fix SientiaMlException propagation in ModelServing.search_runs_by_name to correctly raise the exception with its message, resolving a TypeError. Enhance training test script to support scenario-specific CSV files for different test cases. Update search_runs_by_name return type hint and apply minor code formatting. 2026-02-19 21:13:41 -03:00
Kou Kinoshita
14f3fbadbe SIENTIAPDE-1579: Switched from replace logic to validation + mapping 2026-02-18 18:57:41 -03:00
Kou Kinoshita
5dab1ee576 SIENTIAPDE-1579?: removed duplicated method 2026-02-18 18:18:39 -03:00
Kou Kinoshita
a7922ac3ce SIENTIAPDE-1579: Lint fix 2026-02-18 17:50:58 -03:00
Kou Kinoshita
665870320f SIENTIAPDE-1579: Updated tests and refactored apply filters method 2026-02-18 17:44:46 -03:00
Kou Kinoshita
43cbc31e10 SIENTIAPDE-1579: Lint fixes and formatting 2026-02-18 17:31:58 -03:00
Kou Kinoshita
c6d6f94e05 SIENTIAPDE-1579: Updated tests 2026-02-18 15:05:37 -03:00
df6bf1daba SIENTIAPDE-1430: Refactor static threshold calculation logic and enhance test coverage 2025-12-19 16:19:10 -03:00
06571011f2 SIENTIAPDE-1430: Introduce static_threshold parameter for static window removal.
This parameter allows customizing the threshold (1-1000) used when rem_static_win is enabled, defaulting to 1 if null.
Updates include parameter definition, business rule validation, repository logic for passing the threshold, documentation in README.md and PIPELINE_PARAMS_CHANGELOG.md, and new unit and integration tests.
2025-12-19 15:44:18 -03:00
38fb9a9c53 SIENTIAPDE-1430: Remove verbose options and direct print statements from model, preprocessor, and report utilities. 2025-12-18 21:09:12 -03:00
13941fc3f7 SIENTIAPDE-1430: Add unit tests for _configure_datetime_index (handling various datetime column formats), _init_data_preprocessor (with removed intervals), and _extract_model_equation (supporting polynomial features) in TrainingRepository. 2025-12-18 18:58:12 -03:00
71b654f24c SIENTIAPDE-1430: Add test case for ValueError when y_train_pred is None during artifact data initialization. 2025-12-18 18:48:42 -03:00
573834fb99 SIENTIAPDE-1430: Add comprehensive tests for TrainModelParams.validate_business_rules to improve coverage. 2025-12-18 18:46:01 -03:00
70067fd992 SIENTIAPDE-1430: Improve test coverage for LinearRegressionModel and DataPreprocessor. Added extensive new tests covering various methods, edge cases, and scenarios to enhance overall code coverage. 2025-12-18 18:41:03 -03:00
0d50a76f4c SIENTIAPDE-1430: Add unit tests for Silverman radius and RCE drift metrics. 2025-12-18 18:19:35 -03:00
06fd08dc70 SIENTIAPDE-1430: Introduce comprehensive integration testing with JSON-based scenarios and detailed README documentation. Enhance training workflow to support advanced model configurations, including polynomial regression with mandatory scaler validation. Ensure robust prediction handling by calculating training predictions (y_train_pred) before denormalization and automatically configuring datetime indices for time-series operations. 2025-12-18 17:05:10 -03:00