SIENTIAPDE-994

Refactor activity preparation methods and update Docker configuration for simulator
This commit is contained in:
vitor-aignosi
2025-05-13 10:17:39 -03:00
parent d22545ba88
commit 1156037e08
10 changed files with 290 additions and 11 deletions

View File

@@ -50,5 +50,5 @@ class Activities(Postgres, MLFlow, Gates, OPC):
notification_handler=notification_handler)
@activity.defn(name="prepare_activity")
async def prepare_activity(self, schedule_name: str, model_name: str, model_id: str):
await super().prepare_activity(schedule_name, model_name, model_id)
def prepare_activity(self, input_data: dict[str, Any]):
super().prepare_activity(input_data)

View File

@@ -1,6 +1,6 @@
from logging import Logger
from temporalio import activity
from sientia_do.notifications.handlers import NotificationHandler
from logging import Logger
class BaseActivity:
@@ -8,17 +8,18 @@ class BaseActivity:
self.logger = logger
self.notification_handler = notification_handler
def prepare_activity(self, schedule_name: str,
model_name: str,
model_id: str):
@activity.defn(name="prepare_activity")
def prepare_activity(self, input_data: dict[str, Any]):
"""
Prepare the activity for the notification handler.
Args:
workflow_name (str): The name of the workflow.
schedule_name (str): The name of the schedule.
model_name (str): The name of the model.
model_id (str): The id of the model.
"""
self.notification_handler.base_notification.schedule_name = schedule_name
self.notification_handler.base_notification.model_name = model_name
self.notification_handler.base_notification.model_id = model_id
self.notification_handler.base_notification.pipeline_name = input_data['workflow_name']
self.notification_handler.base_notification.schedule_name = input_data['schedule_name']
self.notification_handler.base_notification.model_name = input_data['model_name']
self.notification_handler.base_notification.model_id = input_data['model_id']