diff --git a/backend/dataall/modules/shares_base/db/share_object_repositories.py b/backend/dataall/modules/shares_base/db/share_object_repositories.py index 596a5771a..e83875c30 100644 --- a/backend/dataall/modules/shares_base/db/share_object_repositories.py +++ b/backend/dataall/modules/shares_base/db/share_object_repositories.py @@ -398,17 +398,16 @@ def fetch_submitted_shares_with_notifications(session): A method used by the scheduled ECS Task to run fetch_submitted_shares_with_notifications() process against ALL shared objects in ALL active share objects within dataall """ - with session() as session: - pending_shares = ( - session.query(ShareObject) - .join( - Notification, - and_( - ShareObject.shareUri == func.split_part(Notification.target_uri, '|', 1), - ShareObject.datasetUri == func.split_part(Notification.target_uri, '|', 2), - ), - ) - .filter(and_(Notification.type == 'SHARE_OBJECT_SUBMITTED', ShareObject.status == 'Submitted')) - .all() + pending_shares = ( + session.query(ShareObject) + .join( + Notification, + and_( + ShareObject.shareUri == func.split_part(Notification.target_uri, '|', 1), + ShareObject.datasetUri == func.split_part(Notification.target_uri, '|', 2), + ), ) - return pending_shares + .filter(and_(Notification.type == 'SHARE_OBJECT_SUBMITTED', ShareObject.status == 'Submitted')) + .all() + ) + return pending_shares diff --git a/backend/dataall/modules/shares_base/tasks/persistent_email_reminders_task.py b/backend/dataall/modules/shares_base/tasks/persistent_email_reminders_task.py index 67a77145f..861f317f6 100644 --- a/backend/dataall/modules/shares_base/tasks/persistent_email_reminders_task.py +++ b/backend/dataall/modules/shares_base/tasks/persistent_email_reminders_task.py @@ -1,11 +1,10 @@ import logging import os import sys +from dataall.base.loader import load_modules, ImportMode from dataall.modules.shares_base.db.share_object_models import ShareObject from dataall.base.db import get_engine -from dataall.base.aws.sqs import SqsQueue -from dataall.core.tasks.service_handlers import Worker -from backend.dataall.modules.shares_base.db.share_object_repositories import ShareObjectRepository +from dataall.modules.shares_base.db.share_object_repositories import ShareObjectRepository from dataall.modules.shares_base.services.share_notification_service import ShareNotificationService from dataall.modules.datasets_base.db.dataset_repositories import DatasetBaseRepository @@ -39,6 +38,7 @@ def persistent_email_reminders(engine): if __name__ == '__main__': + load_modules(modes={ImportMode.SHARES_TASK}) ENVNAME = os.environ.get('envname', 'local') ENGINE = get_engine(envname=ENVNAME) persistent_email_reminders(engine=ENGINE) diff --git a/deploy/stacks/container.py b/deploy/stacks/container.py index bbad9efa5..31a713654 100644 --- a/deploy/stacks/container.py +++ b/deploy/stacks/container.py @@ -59,6 +59,12 @@ def __init__( # This is used for sending data.all share weblinks in the email notifications. if custom_domain and custom_domain.get('hosted_zone_name'): self.env_vars.update({'frontend_domain_url': f'https://{custom_domain["hosted_zone_name"]}'}) + email_sender = ( + custom_domain.get('email_notification_sender_email_id', 'noreply') + + '@' + + custom_domain.get('hosted_zone_name') + ) + self.env_vars.update({'email_sender_id': email_sender}) cluster = ecs.Cluster( self, @@ -330,7 +336,7 @@ def add_share_reapplier_task(self): self.ecs_task_definitions_families.append(share_reapplier_task_definition.family) - @run_if(['modules.dataset_base.features.share_notifications.email.persistent_reminders']) + @run_if(['modules.datasets_base.features.share_notifications.email.persistent_reminders']) def add_persistent_email_reminders_task(self): persistent_email_reminders_task, persistent_email_reminders_task_def = self.set_scheduled_task( cluster=self.ecs_cluster,