From 97f5ee08f126933832a45ee28943461ec2c4ddef Mon Sep 17 00:00:00 2001 From: Bruno Domingues Date: Tue, 7 Oct 2025 14:12:35 -0300 Subject: [PATCH] SIENTIAPDE-1250: Fix: Update pip cache key and replace pytz with datetime.UTC in experiment tracking. --- .github/workflows/quality-gate.yml | 2 +- model_manager/activities/experiment_tracking.py | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/quality-gate.yml b/.github/workflows/quality-gate.yml index 4c1ed8f..36ce79b 100644 --- a/.github/workflows/quality-gate.yml +++ b/.github/workflows/quality-gate.yml @@ -201,7 +201,7 @@ jobs: uses: actions/cache@v3 with: path: ~/.cache/pip - key: ${{ runner.os }}-pip-${{ hashFiles(steps.prepare-requirements.outputs.PROCESSED_REQUIREMENTS_FILE) }} + key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt', 'requirements-dev.txt') }} restore-keys: | ${{ runner.os }}-pip- diff --git a/model_manager/activities/experiment_tracking.py b/model_manager/activities/experiment_tracking.py index 23cbf1b..56ebff3 100644 --- a/model_manager/activities/experiment_tracking.py +++ b/model_manager/activities/experiment_tracking.py @@ -10,11 +10,10 @@ from temporalio import activity, workflow with workflow.unsafe.imports_passed_through(): import traceback - from datetime import datetime + from datetime import UTC, datetime from enum import Enum from typing import Any - import pytz from sientia_do.notifications.handlers import CoreNotificationHandler as NotificationHandler from sientia_do.notifications.models import NotificationLevel from sientia_do.observability.logger import Logger @@ -161,7 +160,7 @@ class ExperimentTracking(Postgres): SET status = %s, updated_at = %s WHERE id = %s """ - query_params = (status, datetime.now(pytz.utc), experiment_run_id) + query_params = (status, datetime.now(UTC), experiment_run_id) elif update_type == UpdateType.STATUS_WITH_ERROR: if not status or not error_message: @@ -178,7 +177,12 @@ class ExperimentTracking(Postgres): SET status = %s, error_message = %s, updated_at = %s WHERE id = %s """ - query_params = (status, error_message, datetime.now(pytz.utc), experiment_run_id) + query_params = ( + status, + error_message, + datetime.now(UTC), + experiment_run_id, + ) elif update_type == UpdateType.MODEL_SAVED: if not run_name: @@ -188,7 +192,7 @@ class ExperimentTracking(Postgres): SET run_name = %s, status = %s, updated_at = %s WHERE id = %s """ - query_params = (run_name, status, datetime.now(pytz.utc), experiment_run_id) + query_params = (run_name, status, datetime.now(UTC), experiment_run_id) else: raise ValueError(f'Invalid update_type: {update_type}')