SIENTIAPDE-1250: Fix: Update pip cache key and replace pytz with datetime.UTC in experiment tracking.

This commit is contained in:
Bruno Domingues
2025-10-07 14:12:35 -03:00
parent 7e1eace77f
commit 97f5ee08f1
2 changed files with 10 additions and 6 deletions

View File

@@ -201,7 +201,7 @@ jobs:
uses: actions/cache@v3 uses: actions/cache@v3
with: with:
path: ~/.cache/pip 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: | restore-keys: |
${{ runner.os }}-pip- ${{ runner.os }}-pip-

View File

@@ -10,11 +10,10 @@ from temporalio import activity, workflow
with workflow.unsafe.imports_passed_through(): with workflow.unsafe.imports_passed_through():
import traceback import traceback
from datetime import datetime from datetime import UTC, datetime
from enum import Enum from enum import Enum
from typing import Any from typing import Any
import pytz
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.notifications.models import NotificationLevel
from sientia_do.observability.logger import Logger from sientia_do.observability.logger import Logger
@@ -161,7 +160,7 @@ class ExperimentTracking(Postgres):
SET status = %s, updated_at = %s SET status = %s, updated_at = %s
WHERE id = %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: elif update_type == UpdateType.STATUS_WITH_ERROR:
if not status or not error_message: if not status or not error_message:
@@ -178,7 +177,12 @@ class ExperimentTracking(Postgres):
SET status = %s, error_message = %s, updated_at = %s SET status = %s, error_message = %s, updated_at = %s
WHERE id = %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: elif update_type == UpdateType.MODEL_SAVED:
if not run_name: if not run_name:
@@ -188,7 +192,7 @@ class ExperimentTracking(Postgres):
SET run_name = %s, status = %s, updated_at = %s SET run_name = %s, status = %s, updated_at = %s
WHERE id = %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: else:
raise ValueError(f'Invalid update_type: {update_type}') raise ValueError(f'Invalid update_type: {update_type}')