SIENTIAPDE-1222

Update requirements and enhance logging in Gates and MLFlow activities

- Updated the sientia-dataops-library and sientia-mlops-library dependencies in requirements.txt to the latest versions.
- Improved debug logging in the Gates activity to display a sample of input data and filters, enhancing clarity and reducing output size.
- Refactored MLFlow activity logging to utilize the create_sample_dict function for better visualization of nested data structures in logs.
This commit is contained in:
vitor-aignosi
2025-09-16 08:54:27 -03:00
parent 1de44e7ed1
commit 31e7e94a95
3 changed files with 12 additions and 46 deletions

View File

@@ -3,13 +3,13 @@ from temporalio import activity, workflow
with workflow.unsafe.imports_passed_through():
from datetime import datetime
import json
from pandas import Timestamp, to_datetime
from sientia_do.temporal.constants import DATETIME_FORMAT, DATETIME_FORMAT_WITH_TZ
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.observability.logger import Logger
from sientia_do.formatters import create_sample_dict
from laborious.utils.repository.model_repository import MLFlowRepository
from typing import Any
import numpy as np
@@ -17,39 +17,6 @@ with workflow.unsafe.imports_passed_through():
import traceback
def create_sample_dict(data: dict, max_items: int = 3, max_depth: int = 2) -> dict:
"""
Create a sample of a dictionary for debugging purposes.
Args:
data: Dictionary to sample
max_items: Maximum number of items to show per level
max_depth: Maximum depth to traverse nested structures
Returns:
Dictionary with sampled content
"""
if max_depth <= 0:
return {"...": "max_depth_reached"}
sample = {}
items = list(data.items())[:max_items]
for key, value in items:
if isinstance(value, dict):
sample[key] = create_sample_dict(value, max_items, max_depth - 1)
elif isinstance(value, list):
sample[key] = value[:max_items] if len(
value) > max_items else value
else:
sample[key] = value
if len(data) > max_items:
sample["..."] = f"({len(data) - max_items} more items)"
return sample
class MLFlow(BaseActivity):
"""
MLFlow integration activities for model inference operations.