From c9dc00fd08e2a6084447c673b8a0895bed037fcf Mon Sep 17 00:00:00 2001 From: vitor-aignosi Date: Tue, 29 Jul 2025 12:45:28 -0300 Subject: [PATCH] SIENTIAPDE-1172 Update GITHUB_BRANCH in values.yaml and enhance error notification handling in MLFlow - Changed GITHUB_BRANCH in values.yaml to reflect the new pipeline for alerts orchestration. - Added NotificationLevel.ERROR to error notifications in MLFlow for retraining and production model updates. - Updated tests to verify error notification levels for model management workflows. --- laborious/activities/mlflow.py | 3 +++ tests/laborious/activities/test_mlflow.py | 3 +++ values.yaml | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/laborious/activities/mlflow.py b/laborious/activities/mlflow.py index 63206a7..b5c3d8a 100644 --- a/laborious/activities/mlflow.py +++ b/laborious/activities/mlflow.py @@ -4,6 +4,7 @@ from temporalio import activity, workflow with workflow.unsafe.imports_passed_through(): from sientia_do.temporal.activities.base import BaseActivity from sientia_do.notifications.handlers import CoreNotificationHandler as NotificationHandler + from sientia_do.notifications.models import NotificationLevel from sientia_do.temporal.utils.logger import Logger from laborious.utils.repository.model_repository import MLFlowRepository from typing import Any @@ -145,6 +146,7 @@ class MLFlow(BaseActivity): notification_id='RETRAIN_MODEL_ERROR', message=f'Error retraining model {model_name}: {e}', block='retrain_model', + level=NotificationLevel.ERROR, attachment_content=trace ) self.error(trace, metadata=metadata) @@ -197,6 +199,7 @@ class MLFlow(BaseActivity): notification_id='UPDATE_PRODUCTION_MODEL_ERROR', message=f'Error updating production model {model_name}: {e}', block='update_production_model', + level=NotificationLevel.ERROR, attachment_content=trace ) self.error(trace, metadata=metadata) diff --git a/tests/laborious/activities/test_mlflow.py b/tests/laborious/activities/test_mlflow.py index 3d83736..8995157 100644 --- a/tests/laborious/activities/test_mlflow.py +++ b/tests/laborious/activities/test_mlflow.py @@ -4,6 +4,7 @@ import numpy as np from pandas import DataFrame from pytest import fixture, mark from laborious.activities.mlflow import MLFlow +from sientia_do.notifications.models import NotificationLevel @patch("laborious.activities.mlflow.MLFlowRepository") @@ -203,6 +204,7 @@ async def test_retrain_model_error(mlflow): notification_id='RETRAIN_MODEL_ERROR', message='Error retraining model test_model: Error retraining model', block='retrain_model', + level=NotificationLevel.ERROR, attachment_content=ANY ) else: @@ -266,6 +268,7 @@ async def test_update_production_model_error(mlflow): notification_id='UPDATE_PRODUCTION_MODEL_ERROR', message='Error updating production model test_model: Error updating production model', block='update_production_model', + level=NotificationLevel.ERROR, attachment_content=ANY ) else: diff --git a/values.yaml b/values.yaml index 03f681b..41291b3 100644 --- a/values.yaml +++ b/values.yaml @@ -123,7 +123,7 @@ env: - name: GITHUB_REPO_URL value: "git@github.com:Aignosi/sientia-dataops-laborious_temporal.git" - name: GITHUB_BRANCH - value: "SIENTIAPDE-1171-criar-pipeline-de-retreino-laborious" + value: "SIENTIAPDE-1172-criar-pipeline-de-alertas-orquestrador" - name: PYTHON_APP value: "laborious.worker.worker"