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.
This commit is contained in:
vitor-aignosi
2025-07-29 12:45:28 -03:00
parent 26887c820c
commit c9dc00fd08
3 changed files with 7 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ from temporalio import activity, workflow
with workflow.unsafe.imports_passed_through(): with workflow.unsafe.imports_passed_through():
from sientia_do.temporal.activities.base import BaseActivity from sientia_do.temporal.activities.base import BaseActivity
from sientia_do.notifications.handlers import CoreNotificationHandler as NotificationHandler 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 sientia_do.temporal.utils.logger import Logger
from laborious.utils.repository.model_repository import MLFlowRepository from laborious.utils.repository.model_repository import MLFlowRepository
from typing import Any from typing import Any
@@ -145,6 +146,7 @@ class MLFlow(BaseActivity):
notification_id='RETRAIN_MODEL_ERROR', notification_id='RETRAIN_MODEL_ERROR',
message=f'Error retraining model {model_name}: {e}', message=f'Error retraining model {model_name}: {e}',
block='retrain_model', block='retrain_model',
level=NotificationLevel.ERROR,
attachment_content=trace attachment_content=trace
) )
self.error(trace, metadata=metadata) self.error(trace, metadata=metadata)
@@ -197,6 +199,7 @@ class MLFlow(BaseActivity):
notification_id='UPDATE_PRODUCTION_MODEL_ERROR', notification_id='UPDATE_PRODUCTION_MODEL_ERROR',
message=f'Error updating production model {model_name}: {e}', message=f'Error updating production model {model_name}: {e}',
block='update_production_model', block='update_production_model',
level=NotificationLevel.ERROR,
attachment_content=trace attachment_content=trace
) )
self.error(trace, metadata=metadata) self.error(trace, metadata=metadata)

View File

@@ -4,6 +4,7 @@ import numpy as np
from pandas import DataFrame from pandas import DataFrame
from pytest import fixture, mark from pytest import fixture, mark
from laborious.activities.mlflow import MLFlow from laborious.activities.mlflow import MLFlow
from sientia_do.notifications.models import NotificationLevel
@patch("laborious.activities.mlflow.MLFlowRepository") @patch("laborious.activities.mlflow.MLFlowRepository")
@@ -203,6 +204,7 @@ async def test_retrain_model_error(mlflow):
notification_id='RETRAIN_MODEL_ERROR', notification_id='RETRAIN_MODEL_ERROR',
message='Error retraining model test_model: Error retraining model', message='Error retraining model test_model: Error retraining model',
block='retrain_model', block='retrain_model',
level=NotificationLevel.ERROR,
attachment_content=ANY attachment_content=ANY
) )
else: else:
@@ -266,6 +268,7 @@ async def test_update_production_model_error(mlflow):
notification_id='UPDATE_PRODUCTION_MODEL_ERROR', notification_id='UPDATE_PRODUCTION_MODEL_ERROR',
message='Error updating production model test_model: Error updating production model', message='Error updating production model test_model: Error updating production model',
block='update_production_model', block='update_production_model',
level=NotificationLevel.ERROR,
attachment_content=ANY attachment_content=ANY
) )
else: else:

View File

@@ -123,7 +123,7 @@ env:
- name: GITHUB_REPO_URL - name: GITHUB_REPO_URL
value: "git@github.com:Aignosi/sientia-dataops-laborious_temporal.git" value: "git@github.com:Aignosi/sientia-dataops-laborious_temporal.git"
- name: GITHUB_BRANCH - name: GITHUB_BRANCH
value: "SIENTIAPDE-1171-criar-pipeline-de-retreino-laborious" value: "SIENTIAPDE-1172-criar-pipeline-de-alertas-orquestrador"
- name: PYTHON_APP - name: PYTHON_APP
value: "laborious.worker.worker" value: "laborious.worker.worker"