Commit Graph

306 Commits

Author SHA1 Message Date
vitor-aignosi
507aded950 SIENTIAPDE-1325
Update image tag and enhance OPC metrics tracking

- Bumped image tag from "1.0.1" to "1.1.0" in values.yaml.
- Added new metrics for OPC connection count and error count in metrics.py.
- Refactored OPC connection handling in opc_repository.py to emit new metrics for connection status, count, and errors.
2025-11-06 16:59:02 -03:00
vitor-aignosi
1695df70ae SIENTIAPDE-1325
Enhance metrics handling in Gates and MLFlow classes

- Added checks for `None` response times before emitting OPC writing metrics in the Gates class to prevent unnecessary metric emissions.
- Updated the MLFlow class to conditionally sort and drop duplicates based on the presence of the 'created_at' column, ensuring robustness in data processing.
- Adjusted corresponding tests to validate the new behavior in both classes.
2025-11-05 16:30:51 -03:00
vitor-aignosi
a3da800cab SIENTIAPDE-1325
Refactor monitoring and metrics integration across various components

- Removed coverage options from `pyproject.toml`.
- Updated prediction metrics in `README.md` to replace `pipeline_name` with `workflow_name`.
- Upgraded `sientia-dataops-library` dependency version in `requirements-light.txt` and `requirements.txt`.
- Enhanced metrics handling in `laborious` activities, including `Activities`, `Gates`, `MLFlow`, and `OPC`, to utilize a new `MetricsController`.
- Refactored metric emission methods to improve clarity and consistency across the codebase.
- Updated tests to reflect changes in metrics handling and ensure proper functionality.
2025-11-04 16:49:10 -03:00
Matheus Demoner
77550d49a6 Merge pull request #28 from Aignosi/fix/SIENTIAPDE-1314-ajustes-nas-camadas-de-monitoramento-do-sientia
SIENTIAPDE-1314: Improve OPC Metrics and Update Prediction Workflow Execution
2025-10-27 15:35:42 -03:00
vitor-aignosi
67af03ee94 SIENTIAPDE-1314
Enhance thread safety in MLFlowRepository model caching

- Introduced a reentrant lock to synchronize access to the model cache, ensuring thread safety during cache checks and updates.
- Updated the cache management logic to acquire the lock when checking for existing models and when updating the cache after downloading a new model.
- Reduced the maximum cached workflows in the worker configuration for improved resource management.
2025-10-27 13:29:01 -03:00
vitor-aignosi
1cbf356d0c SIENTIAPDE-1314
Refactor model cache deletion in MLFlowRepository

- Updated the model cache deletion logic to remove the entire 'target' key instead of just the 'model' subkey, streamlining the cache management process.
2025-10-27 12:28:17 -03:00
vitor-aignosi
22eee9dfba SIENTIAPDE-1314
Refactor workflow names to include 'subworkflow' prefix

- Updated the workflow definitions and calls in the predictions_batch, format_and_export_prediction, and prediction_process files to use the 'subworkflow' prefix for consistency.
- Adjusted corresponding test cases to reflect these changes in workflow execution calls.
2025-10-27 10:14:33 -03:00
vitor-aignosi
be06e0a1b6 SIENTIAPDE-1314
Refactor OPC Test for Output Management

- Added spacing for improved readability in the test_manage_output_tags_failed and test_manage_output_tags_do_nothing functions.
- Reformatted the parameters in the call to manage_output_tags for better clarity and organization.
2025-10-27 08:21:47 -03:00
vitor-aignosi
56122efefa SIENTIAPDE-1314
Enhance OPC Testing for Output Management

- Refactored the test_manage_output_tags_failed function to use parameterization for improved test coverage of different side effects.
- Added a new test_manage_output_tags_do_nothing to verify behavior when an invalid key is provided in the configuration, ensuring that no write operations are performed in this case.
2025-10-27 08:17:57 -03:00
vitor-aignosi
1b93eb19cb SIENTIAPDE-1314
Refactor OPC Class and Enhance Testing for Output Management

- Removed the unused 'success' parameter from the manage_output_tags method in the OPC class to streamline its signature.
- Commented out the error handling logic in the OpcRepository for clarity and future reference.
- Added new tests for manage_output_tags to validate successful and failed write operations, ensuring accurate assertions for output data and metrics.
2025-10-27 08:10:19 -03:00
vitor-aignosi
80c987b2dc SIENTIAPDE-1314
Refactor OPC Write Method and Comment Out Error Handling Logic

- Reformatted the `write_opc_data` method for improved readability by adjusting its signature.
- Commented out the error handling logic in `OpcRepository` related to disconnection due to multiple errors, preserving the original functionality for future reference.
- Updated tests to reflect the commented-out error handling, ensuring clarity in the testing process.
2025-10-27 07:47:11 -03:00
vitor-aignosi
aec5839b5e SIENTIAPDE-1314
Refactor OPC Write Test to Separate Output Data and Metrics

- Updated the test for the OPC write operation to separately assert output data and OPC metrics for improved clarity and accuracy in testing.
- Changed the variable names to reflect the new structure of the returned values from the write operation.
2025-10-24 10:59:48 -03:00
vitor-aignosi
4b9da16aa6 SIENTIAPDE-1314
SIENTIAPDE-1314 Refactor OPC Write Operation in FormatAndExportPrediction Workflow

- Changed the variable name for the result of the OPC write operation for clarity.
- Extracted prediction and metrics from the OPC write result to improve data handling.
2025-10-24 10:22:48 -03:00
vitor-aignosi
723b30b1d6 SIENTIAPDE-1314
Update GITHUB_BRANCH in values.yaml to reflect new monitoring layer adjustments for SIENTIAPDE-1314
2025-10-24 10:14:46 -03:00
vitor-aignosi
fe48b480cf SIENTIAPDE-1314
Increase start-to-close timeout in FormatAndExportPrediction workflow from 60 to 180 seconds for improved execution reliability.
2025-10-24 10:09:46 -03:00
vitor-aignosi
c1a5ab3d3b SIENTIAPDE-1314
Update test_format_and_export_prediction.py to use prediction_data for workflow execution

- Replaced the mock return value with prediction_data in the test_run_none_path_flag function to ensure accurate testing of the workflow's data handling.
2025-10-23 17:55:35 -03:00
vitor-aignosi
0324e2e143 SIENTIAPDE-1314
Enhance OPC Metrics Handling and Refactor Write Operations

- Updated the OPC class to return response times for write operations, improving metrics tracking.
- Refactored the Gates activity to incorporate OPC metrics into the metrics writing process.
- Adjusted the manage_output_tags method in OpcRepository to return response times for each tag written.
- Modified tests to validate the new metrics structure and ensure correct behavior of the updated methods.
2025-10-23 17:48:43 -03:00
Bruno Domingues
32a76b35ea Merge pull request #27 from Aignosi/feature/SIENTIAPDE-1327-controle-de-releases
SIENTIAPDE-1327: Update requirements and simplify CI workflow for quality checks
2025-10-23 10:44:39 -03:00
vitor-aignosi
f0276b0cf4 SIENTIAPDE-1327
SIENTIAPDE-1327: Add requirements file to quality gate workflow

- Included 'requirements-light.txt' in the quality gate workflow to specify additional dependencies for the CI process.
2025-10-23 09:51:41 -03:00
vitor-aignosi
a398e2ea38 SIENTIAPDE-1327
Update requirements and simplify CI workflow for quality checks

- Added new dependencies: kaleido, hyperopt, and shap to requirements.txt.
- Refactored the quality gate workflow to use a template for improved maintainability and reduced complexity.
2025-10-23 09:33:10 -03:00
Matheus Demoner
2cecd8eefb Merge pull request #26 from Aignosi/SIENTIAPDE-1312-melhorias-e-correcoes-nas-pipelines-de-dados
SIENTIAPDE-1312: Refactor Error Handling, Enhance OPC Functionality, and Update Dependencies
2025-10-21 17:24:35 -03:00
vitor-aignosi
c5fb921654 SIENTIAPDE-1312
Refactor error handling in MLFlowRepository and update tests

- Improved error message formatting in MLFlowRepository for better readability.
- Updated test assertions to ensure correct calls to MLflow methods during experiment retrieval and creation.
2025-10-21 15:58:28 -03:00
vitor-aignosi
197a25ebf7 SIENTIAPDE-1312
Ensure model_temp_path directory exists before saving retrain data in MLFlowRepository
2025-10-21 14:40:52 -03:00
vitor-aignosi
4c1e9008ab SIENTIAPDE-1312
Update tests notebook execution count and bump image tag in values.yaml

- Incremented the execution count in the tests notebook for accurate tracking.
- Updated the image tag in values.yaml from "0.0.3" to "1.0.1" for versioning consistency.
- Enhanced error handling in model_repository.py to ensure proper retrieval of created experiments.
2025-10-21 14:32:35 -03:00
vitor-aignosi
461a885eeb SIENTIAPDE-1312
Refactor OPC handling by removing pod_id from initialization and updating logging format

- Removed pod_id parameter from OPC class and repository initialization to streamline connection management.
- Updated logging statements for improved readability during disconnection attempts and error handling.
2025-10-20 16:48:21 -03:00
vitor-aignosi
c2315a9455 SIENTIAPDE-1312
Enhance OpcRepository client initialization and error handling

- Updated the Client instantiation in OpcRepository to include a timeout and watchdog interval for improved connection management.
- Added a disconnection call in the exception handling block to ensure proper resource cleanup during connection failures.
2025-10-20 16:26:01 -03:00
vitor-aignosi
f046d079b5 SIENTIAPDE-1312
Update dependencies and enhance OpcRepository functionality

- Updated sientia-dataops-library version to 1.4.7 in requirements files.
- Modified GITHUB_BRANCH in values.yaml for improved pipeline management.
- Refactored OpcRepository class to inherit from BaseActivity, adding enhanced logging and error handling during disconnection.
- Implemented a disconnection fallback mechanism to ensure graceful handling of OPC server disconnections.
2025-10-20 15:55:51 -03:00
Matheus Demoner
8b5fbfe0ab Merge pull request #25 from Aignosi/SIENTIAPDE-1318-adicionar-pipeline-de-qualidade
Enhance validation script and CI workflow for improved code quality checks (SIENTIAPDE-1318)
2025-10-20 08:36:01 -03:00
vitor-aignosi
04cbce259f SIENTIAPDE-1318
Enhance CI workflow for comprehensive code quality checks

- Added code formatting check, linting, type checking, and security analysis steps using Ruff, mypy, and Bandit.
- Integrated pytest for running tests, ensuring a robust quality gate in the CI pipeline.
2025-10-17 12:34:52 -03:00
vitor-aignosi
3326a7da00 SIENTIAPDE-1318
Remove Pytest test execution from CI workflow and add a blank line in MinioRepository class for improved readability.
2025-10-17 12:15:03 -03:00
vitor-aignosi
50741de2b0 Merge branch 'main' into SIENTIAPDE-1318-adicionar-pipeline-de-qualidade 2025-10-17 12:08:27 -03:00
vitor-aignosi
da8706cf78 SIENTIAPDE-1318
Enhance validation script and CI workflow for improved code quality checks

- Added support for a --fix option in validate.sh to apply Ruff auto-fixes for formatting and linting.
- Updated GitHub Actions workflow to install development and runtime dependencies separately.
- Integrated the validation script execution into the CI pipeline to ensure code quality checks are performed automatically.
2025-10-17 07:55:52 -03:00
Bruno Domingues
1ae268d3f4 Merge pull request #24 from Aignosi/SIENTIAPDE-1231-ajustar-o-retreino-do-courier-no-laborious
SIENTIAPDE-1231, SIENTIAPDE-1222, SIENTIAPDE-1214: Enhance MLFlow, Model Repository, Logging, and Configuration
2025-10-16 12:44:49 -03:00
vitor-aignosi
a7cc917760 SIENTIAPDE-1231
Enhance README with code quality and validation guidelines

- Added a new section on code quality and validation tools, detailing the use of Ruff, mypy, Bandit, and pytest.
- Included installation instructions for development dependencies and options for running validation scripts.
- Provided best practices for maintaining code quality and integrating CI/CD workflows.
2025-10-16 11:04:37 -03:00
vitor-aignosi
644a43093a SIENTIAPDE-1231
Enhance README and repository utilities for clarity and functionality

- Updated README.md to improve descriptions and structure, adding detailed sections for features, workflows, and architecture.
- Enhanced MinioRepository with comprehensive docstrings for methods and class attributes, improving usability and documentation.
- Refined MLFlowRepository with clearer method descriptions and improved logging for better observability and maintainability.
2025-10-16 11:01:36 -03:00
vitor-aignosi
de47820c4a SIENTIAPDE-1231
Refactor tests and update model_repository.py for clarity and consistency

- Added a blank line in model_repository.py for improved readability.
- Adjusted formatting in test_mlflow.py to streamline assertions.
- Updated ensure_bucket_exists method tests in test_minio_repository.py to reflect the new return value of None instead of True.
2025-10-16 10:15:53 -03:00
vitor-aignosi
d59833a5e5 SIENTIAPDE-1231
Update .gitignore to include mlruns and remove Dockerfile for project simplification
2025-10-16 10:08:34 -03:00
vitor-aignosi
13644d5ebf SIENTIAPDE-1231
Remove obsolete job and MLflow metadata files to streamline project structure and eliminate unused configurations.
2025-10-16 10:08:04 -03:00
vitor-aignosi
f8397582d4 SIENTIAPDE-1231
Refactor MinioRepository and MLFlowRepository for improved functionality and error handling

- Updated `ensure_bucket_exists` method in MinioRepository to return None instead of a boolean, streamlining bucket existence checks.
- Replaced hardcoded error messages in MLFlowRepository with a constant for better maintainability.
- Adjusted column assignment in MLFlowRepository to use pd.Index for improved clarity.
2025-10-16 10:06:42 -03:00
vitor-aignosi
d8f4006488 SIENTIAPDE-1231
SIENTIAPDE-1231 Add mlflow to requirements-light.txt for enhanced model tracking capabilities
2025-10-16 09:49:56 -03:00
vitor-aignosi
358ad8b871 SIENTIAPDE-1231 2025-10-16 09:32:53 -03:00
vitor-aignosi
3caa52d8b8 SIENTIAPDE-1231
Update .gitignore and remove values.yaml for project cleanup

- Added .ruff_cache/ and catboost_info/ to .gitignore to prevent tracking of temporary files and caches.
- Deleted values.yaml to remove outdated configuration settings, streamlining the project structure.
2025-10-16 09:31:49 -03:00
vitor-aignosi
8ba646bb55 Merge branch 'main' into SIENTIAPDE-1231-ajustar-o-retreino-do-courier-no-laborious 2025-10-16 09:05:58 -03:00
vitor-aignosi
f0fb9b854e SIENTIAPDE-1231
Enhance validation script and refactor code in various modules

- Updated the validation script to include automatic code formatting and linting fixes using Ruff.
- Removed the `clean_tmp_files` method from the Gates class to streamline functionality.
- Simplified conditional checks in the OpcRepository for better clarity and error handling.
- Added model ID to the minimal retrain workflow for improved tracking.
- Introduced new test cases for error handling in MLFlow and storage operations, ensuring robustness in repository interactions.
2025-10-15 16:50:38 -03:00
vitor-aignosi
ac795c7c53 SIENTIAPDE-1231
Update .gitignore and refactor metrics.py for improved logging and consistency

- Added coverage.xml to .gitignore to prevent tracking of coverage reports.
- Refactored metric labels in metrics.py for consistency in string formatting and improved readability.
- Enhanced logging messages in various activities to ensure uniformity in message formatting.
2025-10-15 16:00:18 -03:00
vitor-aignosi
a5d2b0d3fd SIENTIAPDE-1231
Refactor `force_memory_release` function in model_repository.py to improve logging

- Updated the `force_memory_release` function to remove metadata parameter and enhance logging by using `logger.info()` instead of `logger.custom_info()`.
- Adjusted calls to `force_memory_release` in the MLFlowRepository to pass the logger instance, ensuring consistent logging during memory management operations.
2025-10-13 15:59:10 -03:00
vitor-aignosi
a3989b84af SIENTIAPDE-1231
Refactor memory management in MLFlowRepository to use `force_memory_release` function

- Replaced direct calls to `gc.collect()` with `force_memory_release()` for improved memory optimization after model deletion.
- This change enhances memory management during model operations, ensuring more efficient resource handling.
2025-10-13 15:57:23 -03:00
vitor-aignosi
143dd7759e SIENTIAPDE-1231
Add memory management function to model_repository.py

- Introduced `force_memory_release` function to enhance memory management by triggering garbage collection and attempting to release unused memory.
- Utilized `ctypes` to call `malloc_trim` for further memory optimization, improving overall performance during model operations.
2025-10-13 15:50:37 -03:00
vitor-aignosi
331df2dd18 SIENTIAPDE-1231
Enhance MLFlowRepository memory management by adding garbage collection and logging for model deletion

- Introduced garbage collection after model deletion to optimize memory usage.
- Added logging to inform when a model is deleted from memory, improving traceability during predictions.
2025-10-13 15:31:04 -03:00
vitor-aignosi
fdaf48ddc9 SIENTIAPDE-1231
Update values.yaml and model_repository.py for configuration and error handling improvements

- Increased replicaCount from 1 to 2 in values.yaml for enhanced scalability.
- Updated image tag from "0.0.2" to "0.0.3" in values.yaml to reflect the latest version.
- Enhanced error messaging in model_repository.py to include the actual index type when raising ValueError for index type validation.
2025-10-13 15:12:20 -03:00