Commit Graph

527 Commits

Author SHA1 Message Date
fdeafe9768 SAM0123-320: fix: call pyfunc data model predict with wrapper signature
When a data model's `fit` returns the refit object instead of a DataFrame,
`fit_models` called `predict(data)` sklearn-style. A pyfunc wrapper's
`predict` takes `(context, model_input)`, so Courier Stratified retrain
failed with "missing 1 required positional argument: 'model_input'".

Mirror `get_prediction_data`: pass `{}` as context when the transform
flavor is pyfunc.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 16:47:31 -03:00
25f11fa943 SAM0123-320: fix: evict stale artifact modules before loading a model
A long-lived worker kept the first `utils_slr` it ever imported in
`sys.modules`, so every later load unpickled against that stale class and
ignored the freshly downloaded `code/`. Courier Stratified retrain kept
failing on an old `StratifiedTransformerWrapper.fit` from a months-old
`/tmp/tmpvutfjrti` download.

`prepend_artifact_code_dir` now evicts cached modules shipped by the
artifact's `code/` that were imported from an artifact code directory,
and moves the directory to the front of `sys.path` when already present.
Modules installed in the image are never touched.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-07 16:08:09 -03:00
8ef7ed800a SIENTIAPDE-2071: chore: remove dead Makefile
Some checks failed
Quality gate / quality-gate (push) Has been cancelled
Card 16 of the SIENTIAPDE-2052 epic. This repo is a Flow B dataops
worker, it does not build its own image at all anymore, it runs off
a shared runtime image with code cloned from Gitea at deploy time. A
per repo image build Makefile pointing at aignosi.azurecr.io is dead
weight, no workflow calls make. Safe to remove.
2026-09-15 00:08:37 -03:00
github-actions[bot]
ac67d5b447 chore: bump version to 0.7.2 2026-09-11 15:19:06 +00:00
ci-dependencies-fetcher[bot]
ce91a0bbb6 Revert "chore: bump version to 0.7.2"
This reverts commit 959c78170c.
2026-09-11 14:49:24 +00:00
github-actions[bot]
959c78170c chore: bump version to 0.7.2 2026-09-11 14:43:24 +00:00
ci-dependencies-fetcher[bot]
5690e792a9 Revert "chore: bump version to 0.7.1"
This reverts commit 76351fdf8a.
2026-09-11 13:47:36 +00:00
github-actions[bot]
76351fdf8a chore: bump version to 0.7.1 2026-09-11 13:47:07 +00:00
Bruno Domingues
070956def9 Merge pull request #51 from Aignosi/fix/SIENTIAPDE-2068
feat(cicd): Migrate laborious-worker deployment to Flow B
2026-09-11 10:46:41 -03:00
85fe4663b1 SIENTIAPDE-2068: feat(cicd): migrate laborious-worker deploy to Flow B (legacy only)
- Delete release.yml (tarball-only, no deploy job).
- Add deploy.yml calling reusable-deploy-dataops.yml, bumping only the
  legacy runtime's GITHUB_BRANCH via the new profile/profile_env_list_path
  mechanism — basic is left untouched for now. workflow_dispatch has no
  inputs.
- Add require-chart-ref-label.yml.
2026-09-11 10:36:06 -03:00
e2fbf841fc Merge pull request #49 from Aignosi/feature/QTZPOC-20
QTZPOC-20: .sientia Model Import, Workflow Enhancements, and Robust Failure Handling
2026-09-10 16:56:56 -03:00
b65cf2ba68 QTZPOC-20
QTZPOC-20: Pin mlflow dependency to version 2.10.1 in requirements-light.txt
2026-09-10 16:18:18 -03:00
1c32e9d678 QTZPOC-20
QTZPOC-20: Remove trailing newline from sonar-project.properties
2026-09-10 15:09:35 -03:00
bf48a18c7b QTZPOC-20
QTZPOC-20: Improve worker shutdown handling by allowing SystemExit and KeyboardInterrupt to propagate directly, preserving their original exit codes and ensuring cleanup.
2026-09-10 14:25:08 -03:00
6c0d178f99 QTZPOC-20
QTZPOC-20: Implement structured logging with metadata for repository, worker, and OPC activities.
2026-09-10 14:15:42 -03:00
4cccc45c34 QTZPOC-20
QTZPOC-20: Consolidate written_code_dir assignment into a single line in sklearn flavor retrain E2E test.
2026-09-10 11:50:51 -03:00
512a49f78f QTZPOC-20
QTZPOC-20: Enable code_paths for sklearn models; improve worker shutdown handling

The MLFlowRepository now resolves and forwards code_paths to mlflow.sklearn.log_model, ensuring custom code dependencies for sklearn models are preserved and correctly reloaded. A new integration test validates this end-to-end functionality. Additionally, worker exception handling is refined to distinguish between deliberate shutdowns (SystemExit, KeyboardInterrupt) and unhandled exceptions, preventing unnecessary error logging for expected exits.
2026-09-10 11:46:29 -03:00
bda83e7943 QTZPOC-20
QTZPOC-20: Remove redundant parentheses from BaseException catch clauses
2026-09-10 09:43:04 -03:00
e600c7922e QTZPOC-20
QTZPOC-20: Remove redundant NOSONAR comments across multiple files.
2026-09-10 09:39:21 -03:00
9e0da03717 QTZPOC-20
QTZPOC-20: Refactor test calls by extracting inline arguments into local variables for improved readability.
2026-09-10 09:34:06 -03:00
7c45dbb407 QTZPOC-20
QTZPOC-20: Apply minor formatting adjustments to improve code readability.
2026-09-10 09:23:31 -03:00
4c7cae502f QTZPOC-20
QTZPOC-20: Refactor ModelImport status engine for lazy initialization, add byte-counted size validation to bundle extraction, optimize MLflow run ID lookups, and ensure workflow cancellation propagates correctly.
2026-09-10 08:59:31 -03:00
d06ce0daae QTZPOC-20
QTZPOC-20: Improve test readability by assigning claim_input() to a payload variable before use.
2026-09-09 08:58:48 -03:00
37544edafe QTZPOC-20
QTZPOC-20: Improve error handling and classification tests for model import activities and add validation for OPC repository security.
2026-09-09 08:49:23 -03:00
abfd474e4d QTZPOC-20
QTZPOC-20: Enhance OPC repository client configuration and secure connection validation; refine MLflow test error handling and async test execution; add SonarQube suppressions.
2026-09-09 08:26:59 -03:00
eb89917c5a QTZPOC-20
QTZPOC-20: Clarify broad exception handling in OPC repository and refactor asyncio imports in worker tests.
2026-09-08 17:19:45 -03:00
192834bde3 QTZPOC-20
QTZPOC-20: Refactor model import workflow, introduce atomic model ID generation, and clarify MinIO expiry.

Fuses bundle download, decryption, MLflow experiment creation, and artifact upload into a single activity to prevent cross-worker issues. Implements an atomic counter for MongoDB model IDs, replacing the max(id) + 1 scan to avoid collisions during concurrent imports. Adds comprehensive documentation for MinIO object expiry mechanisms and refines lifecycle rule application. Improves error handling with clearer responsibility classification and centralizes MLflow repository injection.
2026-09-08 17:06:25 -03:00
e4fc12e529 QTZPOC-20
QTZPOC-20: Enhance system robustness and test coverage across bundle processing, activity error handling, and worker operations.

*   Strengthen bundle reader validation with new tests for archive integrity, security vulnerabilities (e.g., path traversal, duplicate entries, special file types), and I/O error resilience.
*   Improve error handling and status propagation in PI Web API, MLflow, and OPC activities, including partial write scenarios and OPC session management.
*   Add comprehensive tests for worker startup, configuration, graceful shutdown, and Prometheus metrics server initialization.
*   Introduce a new utility for intelligent DataFrame debugging, summarizing large dataframes for concise logging, and refine exception chain summarization.
*   Update code coverage configuration to exclude @overload decorator lines.
2026-09-08 09:42:23 -03:00
61db575cdc QTZPOC-20
QTZPOC-20: Add NOSONAR comment to summarize_failure function to suppress static analysis warning.
2026-09-04 15:23:55 -03:00
72a55c0900 QTZPOC-20
QTZPOC-20: Raise non-retryable Temporal ApplicationError when no data is returned from query in minimal retrain workflow.
2026-09-04 11:55:18 -03:00
d257e70465 QTZPOC-20
QTZPOC-20: Refactor test inputs into named variables for improved readability and debugging.
2026-09-04 11:35:34 -03:00
7b2e90a9f9 QTZPOC-20
QTZPOC-20: Simplify base64 decoding error handling and improve run name derivation test specificity
2026-09-04 11:15:48 -03:00
bde614e2a6 QTZPOC-20
QTZPOC-20: Refactor model repository tests for improved assertion logic and exception handling, including correcting pytest.raises exception access and refining mock verifications.
2026-09-04 10:54:23 -03:00
6a412147ee QTZPOC-20
QTZPOC-20: Add pynacl==1.5.0 to requirements-light.txt
2026-09-04 10:02:26 -03:00
220ee5509c QTZPOC-20
QTZPOC-20: Remove hashlib from development requirements.
2026-09-04 09:53:08 -03:00
09027bc93b QTZPOC-20
QTZPOC-20: Add skip_predict_timestamp flag to model_config to prevent timestamp reinsertion in prediction data, and document other ad-hoc behavioral flags.
2026-09-03 12:04:47 -03:00
086b65c45f QTZPOC-20
QTZPOC-20: Make metadata parameter optional in check_artifact_exists method.
2026-09-01 13:54:51 -03:00
30ff378cb7 QTZPOC-20
QTZPOC-20: Prioritize code/ directory download and sys.path injection before model loading, enabling MLflow flavors to stream models directly from URIs and simplifying joblib artifact handling.
2026-09-01 13:27:32 -03:00
c1a44a9d7a QTZPOC-20
QTZPOC-20: Unify artifact code directory handling for all model flavors and standardize joblib pickle path

Implemented a robust mechanism to ensure an artifact's code/ directory is prepended to sys.path before loading for sklearn, pyfunc, and joblib flavors. sklearn and pyfunc now resolve MLflow URIs to local directories first to facilitate this sys.path modification. Standardized the joblib flavor to explicitly read and write model.pkl within the artifact directory. Updated documentation and added comprehensive tests to reflect these changes.
2026-08-28 15:10:46 -03:00
f4c110cd8a Merge branch 'main' into feature/QTZPOC-20 2026-08-28 10:09:00 -03:00
dfb9deae1a QTZPOC-20
QTZPOC-20: Remove PyTorch from supported model flavors as it was never functional due to missing runtime dependencies.
2026-08-27 14:58:43 -03:00
853c83e662 QTZPOC-20
QTZPOC-20: Improve structured logging and reporting for all model import pipeline failures by introducing a dedicated activity and centralizing error classification. This ensures consistent observability, with all workflow failures now reported before cleanup. Also, adjusted import step timeouts and refined manual run script cleanup logic.
2026-08-27 14:44:57 -03:00
e95e65b72b QTZPOC-20
QTZPOC-20: Implement explicit joblib model flavor and enhance model import workflow with extensive E2E tests.

This commit introduces a first-class joblib model flavor for direct loading and saving of Python pickle artifacts, including custom code within the artifact's code/ directory, bypassing MLflow's flavor loaders. The model import workflow's status database configuration is now streamlined to default to the POSTGRES_* server, with explicit IMPORT_STATUS_DB_* overrides.

Comprehensive end-to-end tests have been added for the model import workflow, covering success paths, gate rejections, digest enforcement, provisioning failures, status record integrity, cleanup, and retry/recovery scenarios using a real-clock environment. New E2
2026-08-26 15:45:33 -03:00
dac4f1718f QTZPOC-20
QTZPOC-20: Implement model import workflow for .sientia bundles

Introduces the import_model workflow and its associated activities to enable importing .sientia bundles into MLflow and MongoDB. This includes:

*   New core workflow and activity logic for handling bundle download, decryption, validation, MLflow provisioning (experiments, runs, registered versions), and MongoDB model document creation.
*   Comprehensive E2E and unit test suites, including a dedicated test harness and a manual run script for development.
*   Updated .env.example and README.md with new configurations and usage instructions.
*   Ensures correct MLflow model source resolution for legacy loader compatibility and robust MongoDB document management.
*   Refactors existing utility scripts into a scripts/ directory.
2026-08-25 17:07:42 -03:00
4e3f26f1c1 Merge pull request #46 from Aignosi/fix/SIENTIAPDE-2072
SIENTIAPDE-2072: bump sientia_do pin to 1.12.2
2026-08-25 16:37:06 -03:00
83b025ff9f Merge branch 'main' into fix/SIENTIAPDE-2072 2026-08-25 16:32:39 -03:00
0e445de386 QTZPOC-20
QTZPOC-20: Implement .sientia model bundle import workflow

Introduces a new Temporal workflow and activities to import .sientia model bundles. This enables:
- Secure decryption and validation of bundles through a seven-gate process.
- Provisioning imported models in MLflow and updating the MongoDB model listing.
- Comprehensive status tracking in the public.experiment_run table with new IMPORT_SUCCESS/IMPORT_ERROR states.
- Dedicated metrics, robust error handling, and configurable settings.
- Includes updated e2e database fixtures and extensive unit/integration tests for bundle format, reader, and overall workflow.
2026-08-25 10:40:46 -03:00
4576502d78 Merge pull request #45 from Aignosi/fix/QTZPOC-13
Introduce joblib fallback for MLflow model loading
2026-08-20 10:36:33 -03:00
291d16efa5 QTZPOC-13
QTZPOC-13: Centralize MLflow joblib fallback logic, ensuring consistent model version resolution by reusing the initial run ID, improving logging, and updating dependencies.
2026-08-20 10:23:24 -03:00
03ac4b31e5 QTZPOC-13
fix coverage
2026-08-20 08:28:45 -03:00