Refactor activity methods and update requirements.txt to enhance functionality and remove deprecated filters. Added detailed docstrings for clarity and improved error handling in data processing workflows.
25 lines
940 B
Python
25 lines
940 B
Python
from temporalio import activity
|
|
from sientia_do.notifications.handlers import NotificationHandler
|
|
from logging import Logger
|
|
|
|
|
|
class BaseActivity:
|
|
def __init__(self, logger: Logger, notification_handler: NotificationHandler):
|
|
self.logger = logger
|
|
self.notification_handler = notification_handler
|
|
|
|
def prepare_activity(self, schedule_name: str,
|
|
model_name: str,
|
|
model_id: str):
|
|
"""
|
|
Prepare the activity for the notification handler.
|
|
|
|
Args:
|
|
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
|