From d68d69a0c9b98079998dd160e52695eabc43bd76 Mon Sep 17 00:00:00 2001 From: dlpzx Date: Wed, 5 Jun 2024 08:52:18 +0200 Subject: [PATCH 1/3] Move exceptions to shares_base --- .../modules/s3_datasets_shares/services/share_item_service.py | 2 +- .../services/share_managers/s3_access_point_share_manager.py | 2 +- .../services/share_managers/s3_bucket_share_manager.py | 2 +- .../s3_datasets_shares/services/share_object_service.py | 2 +- .../services/share_processors/glue_table_share_processor.py | 2 +- .../share_processors/s3_access_point_share_processor.py | 2 +- .../services/share_processors/s3_bucket_share_processor.py | 2 +- .../services/share_exceptions.py | 0 .../dataall/modules/shares_base/services/sharing_service.py | 4 ++-- 9 files changed, 9 insertions(+), 9 deletions(-) rename backend/dataall/modules/{s3_datasets_shares => shares_base}/services/share_exceptions.py (100%) diff --git a/backend/dataall/modules/s3_datasets_shares/services/share_item_service.py b/backend/dataall/modules/s3_datasets_shares/services/share_item_service.py index f12e0b5f7..8ba041546 100644 --- a/backend/dataall/modules/s3_datasets_shares/services/share_item_service.py +++ b/backend/dataall/modules/s3_datasets_shares/services/share_item_service.py @@ -21,7 +21,7 @@ ShareObjectSM, ShareItemSM, ) -from dataall.modules.s3_datasets_shares.services.share_exceptions import ShareItemsFound +from dataall.modules.shares_base.services.share_exceptions import ShareItemsFound from dataall.modules.s3_datasets_shares.services.share_notification_service import ShareNotificationService from dataall.modules.shares_base.services.share_permissions import ( GET_SHARE_OBJECT, diff --git a/backend/dataall/modules/s3_datasets_shares/services/share_managers/s3_access_point_share_manager.py b/backend/dataall/modules/s3_datasets_shares/services/share_managers/s3_access_point_share_manager.py index 2823e0a76..99d744b08 100644 --- a/backend/dataall/modules/s3_datasets_shares/services/share_managers/s3_access_point_share_manager.py +++ b/backend/dataall/modules/s3_datasets_shares/services/share_managers/s3_access_point_share_manager.py @@ -20,7 +20,7 @@ from dataall.base.aws.iam import IAM from dataall.modules.s3_datasets_shares.services.dataset_sharing_alarm_service import DatasetSharingAlarmService from dataall.modules.s3_datasets_shares.db.share_object_repositories import ShareObjectRepository -from dataall.modules.s3_datasets_shares.services.share_exceptions import PrincipalRoleNotFound +from dataall.modules.shares_base.services.share_exceptions import PrincipalRoleNotFound from dataall.modules.s3_datasets_shares.services.share_managers.share_manager_utils import ShareErrorFormatter from dataall.modules.s3_datasets_shares.services.managed_share_policy_service import ( SharePolicyService, diff --git a/backend/dataall/modules/s3_datasets_shares/services/share_managers/s3_bucket_share_manager.py b/backend/dataall/modules/s3_datasets_shares/services/share_managers/s3_bucket_share_manager.py index 9d255e4c9..e8154901b 100644 --- a/backend/dataall/modules/s3_datasets_shares/services/share_managers/s3_bucket_share_manager.py +++ b/backend/dataall/modules/s3_datasets_shares/services/share_managers/s3_bucket_share_manager.py @@ -13,7 +13,7 @@ ) from dataall.modules.s3_datasets_shares.aws.s3_client import S3ControlClient, S3Client, DATAALL_READ_ONLY_SID from dataall.modules.shares_base.db.share_object_models import ShareObject -from dataall.modules.s3_datasets_shares.services.share_exceptions import PrincipalRoleNotFound +from dataall.modules.shares_base.services.share_exceptions import PrincipalRoleNotFound from dataall.modules.s3_datasets_shares.services.share_managers.share_manager_utils import ShareErrorFormatter from dataall.modules.s3_datasets_shares.services.dataset_sharing_alarm_service import DatasetSharingAlarmService from dataall.modules.s3_datasets_shares.services.managed_share_policy_service import ( diff --git a/backend/dataall/modules/s3_datasets_shares/services/share_object_service.py b/backend/dataall/modules/s3_datasets_shares/services/share_object_service.py index 4fd49a15e..0ed112e07 100644 --- a/backend/dataall/modules/s3_datasets_shares/services/share_object_service.py +++ b/backend/dataall/modules/s3_datasets_shares/services/share_object_service.py @@ -26,7 +26,7 @@ ShareObjectSM, ShareItemSM, ) -from dataall.modules.s3_datasets_shares.services.share_exceptions import ShareItemsFound, PrincipalRoleNotFound +from dataall.modules.shares_base.services.share_exceptions import ShareItemsFound, PrincipalRoleNotFound from dataall.modules.s3_datasets_shares.services.share_item_service import ShareItemService from dataall.modules.s3_datasets_shares.services.share_notification_service import ShareNotificationService from dataall.modules.s3_datasets_shares.services.managed_share_policy_service import SharePolicyService diff --git a/backend/dataall/modules/s3_datasets_shares/services/share_processors/glue_table_share_processor.py b/backend/dataall/modules/s3_datasets_shares/services/share_processors/glue_table_share_processor.py index 024813934..a4879d98f 100644 --- a/backend/dataall/modules/s3_datasets_shares/services/share_processors/glue_table_share_processor.py +++ b/backend/dataall/modules/s3_datasets_shares/services/share_processors/glue_table_share_processor.py @@ -10,7 +10,7 @@ ShareableType, ) from dataall.modules.s3_datasets.db.dataset_models import DatasetTable -from dataall.modules.s3_datasets_shares.services.share_exceptions import PrincipalRoleNotFound +from dataall.modules.shares_base.services.share_exceptions import PrincipalRoleNotFound from dataall.modules.s3_datasets_shares.services.share_managers import LFShareManager from dataall.modules.s3_datasets_shares.aws.ram_client import RamClient from dataall.modules.s3_datasets_shares.services.share_object_service import ShareObjectService diff --git a/backend/dataall/modules/s3_datasets_shares/services/share_processors/s3_access_point_share_processor.py b/backend/dataall/modules/s3_datasets_shares/services/share_processors/s3_access_point_share_processor.py index 8021873a7..76cab06f4 100644 --- a/backend/dataall/modules/s3_datasets_shares/services/share_processors/s3_access_point_share_processor.py +++ b/backend/dataall/modules/s3_datasets_shares/services/share_processors/s3_access_point_share_processor.py @@ -2,7 +2,7 @@ from datetime import datetime from typing import List -from dataall.modules.s3_datasets_shares.services.share_exceptions import PrincipalRoleNotFound +from dataall.modules.shares_base.services.share_exceptions import PrincipalRoleNotFound from dataall.modules.s3_datasets_shares.services.share_managers import S3AccessPointShareManager from dataall.modules.s3_datasets_shares.services.share_object_service import ShareObjectService from dataall.modules.s3_datasets_shares.services.share_item_service import ShareItemService diff --git a/backend/dataall/modules/s3_datasets_shares/services/share_processors/s3_bucket_share_processor.py b/backend/dataall/modules/s3_datasets_shares/services/share_processors/s3_bucket_share_processor.py index 021ba9ccc..df5f292fa 100644 --- a/backend/dataall/modules/s3_datasets_shares/services/share_processors/s3_bucket_share_processor.py +++ b/backend/dataall/modules/s3_datasets_shares/services/share_processors/s3_bucket_share_processor.py @@ -2,7 +2,7 @@ from datetime import datetime from typing import List -from dataall.modules.s3_datasets_shares.services.share_exceptions import PrincipalRoleNotFound +from dataall.modules.shares_base.services.share_exceptions import PrincipalRoleNotFound from dataall.modules.s3_datasets_shares.services.share_managers import S3BucketShareManager from dataall.modules.s3_datasets_shares.services.share_object_service import ShareObjectService from dataall.modules.shares_base.services.shares_enums import ( diff --git a/backend/dataall/modules/s3_datasets_shares/services/share_exceptions.py b/backend/dataall/modules/shares_base/services/share_exceptions.py similarity index 100% rename from backend/dataall/modules/s3_datasets_shares/services/share_exceptions.py rename to backend/dataall/modules/shares_base/services/share_exceptions.py diff --git a/backend/dataall/modules/shares_base/services/sharing_service.py b/backend/dataall/modules/shares_base/services/sharing_service.py index c412f9845..f47a2e277 100644 --- a/backend/dataall/modules/shares_base/services/sharing_service.py +++ b/backend/dataall/modules/shares_base/services/sharing_service.py @@ -22,10 +22,10 @@ from dataall.modules.s3_datasets_shares.services.share_object_service import ( ShareObjectService, ) # TODO move to shares_base in following PR -from dataall.modules.s3_datasets_shares.services.share_exceptions import ( +from dataall.modules.shares_base.services.share_exceptions import ( PrincipalRoleNotFound, DatasetLockTimeout, -) # TODO move to shares_base in following PR +) from dataall.modules.datasets_base.db.dataset_models import DatasetLock log = logging.getLogger(__name__) From faa167529b383cf62953cce68c8302b4714b43e1 Mon Sep 17 00:00:00 2001 From: dlpzx Date: Wed, 5 Jun 2024 08:57:46 +0200 Subject: [PATCH 2/3] Move notifications to shares_base --- .../modules/s3_datasets_shares/services/share_item_service.py | 2 +- .../s3_datasets_shares/services/share_object_service.py | 2 +- .../s3_datasets_shares/tasks/dataset_subscription_task.py | 2 +- .../services/share_notification_service.py | 3 +-- 4 files changed, 4 insertions(+), 5 deletions(-) rename backend/dataall/modules/{s3_datasets_shares => shares_base}/services/share_notification_service.py (98%) diff --git a/backend/dataall/modules/s3_datasets_shares/services/share_item_service.py b/backend/dataall/modules/s3_datasets_shares/services/share_item_service.py index 8ba041546..b3a5cd563 100644 --- a/backend/dataall/modules/s3_datasets_shares/services/share_item_service.py +++ b/backend/dataall/modules/s3_datasets_shares/services/share_item_service.py @@ -22,7 +22,7 @@ ShareItemSM, ) from dataall.modules.shares_base.services.share_exceptions import ShareItemsFound -from dataall.modules.s3_datasets_shares.services.share_notification_service import ShareNotificationService +from dataall.modules.shares_base.services.share_notification_service import ShareNotificationService from dataall.modules.shares_base.services.share_permissions import ( GET_SHARE_OBJECT, ADD_ITEM, diff --git a/backend/dataall/modules/s3_datasets_shares/services/share_object_service.py b/backend/dataall/modules/s3_datasets_shares/services/share_object_service.py index 0ed112e07..d88678244 100644 --- a/backend/dataall/modules/s3_datasets_shares/services/share_object_service.py +++ b/backend/dataall/modules/s3_datasets_shares/services/share_object_service.py @@ -28,7 +28,7 @@ ) from dataall.modules.shares_base.services.share_exceptions import ShareItemsFound, PrincipalRoleNotFound from dataall.modules.s3_datasets_shares.services.share_item_service import ShareItemService -from dataall.modules.s3_datasets_shares.services.share_notification_service import ShareNotificationService +from dataall.modules.shares_base.services.share_notification_service import ShareNotificationService from dataall.modules.s3_datasets_shares.services.managed_share_policy_service import SharePolicyService from dataall.modules.shares_base.services.share_permissions import ( REJECT_SHARE_OBJECT, diff --git a/backend/dataall/modules/s3_datasets_shares/tasks/dataset_subscription_task.py b/backend/dataall/modules/s3_datasets_shares/tasks/dataset_subscription_task.py index b0a3f127b..d7b0ddd4b 100644 --- a/backend/dataall/modules/s3_datasets_shares/tasks/dataset_subscription_task.py +++ b/backend/dataall/modules/s3_datasets_shares/tasks/dataset_subscription_task.py @@ -11,7 +11,7 @@ from dataall.base.db import get_engine from dataall.modules.shares_base.db.share_object_models import ShareObjectItem from dataall.modules.s3_datasets_shares.db.share_object_repositories import ShareObjectRepository -from dataall.modules.s3_datasets_shares.services.share_notification_service import ShareNotificationService +from dataall.modules.shares_base.services.share_notification_service import ShareNotificationService from dataall.modules.s3_datasets.aws.sns_dataset_client import SnsDatasetClient from dataall.modules.s3_datasets.db.dataset_location_repositories import DatasetLocationRepository from dataall.modules.s3_datasets.db.dataset_table_repositories import DatasetTableRepository diff --git a/backend/dataall/modules/s3_datasets_shares/services/share_notification_service.py b/backend/dataall/modules/shares_base/services/share_notification_service.py similarity index 98% rename from backend/dataall/modules/s3_datasets_shares/services/share_notification_service.py rename to backend/dataall/modules/shares_base/services/share_notification_service.py index d97dcc308..2efe8db69 100644 --- a/backend/dataall/modules/s3_datasets_shares/services/share_notification_service.py +++ b/backend/dataall/modules/shares_base/services/share_notification_service.py @@ -6,7 +6,6 @@ from dataall.core.tasks.db.task_models import Task from dataall.core.tasks.service_handlers import Worker from dataall.modules.shares_base.db.share_object_models import ShareObject -from dataall.modules.s3_datasets.db.dataset_models import S3Dataset from dataall.base.context import get_context from dataall.modules.shares_base.services.shares_enums import ShareObjectStatus from dataall.modules.notifications.db.notification_repositories import NotificationRepository @@ -35,7 +34,7 @@ class ShareNotificationService: - share.owner (person that opened the request) OR share.groupUri (if group_notifications=true) """ - def __init__(self, session, dataset: S3Dataset, share: ShareObject): + def __init__(self, session, dataset, share: ShareObject): self.dataset = dataset self.share = share self.session = session From 066e8597b62b0d4df6adf6e4c0774b901bf4cc51 Mon Sep 17 00:00:00 2001 From: dlpzx Date: Thu, 6 Jun 2024 14:33:26 +0200 Subject: [PATCH 3/3] Add DatasetBase for notifications type --- .../modules/shares_base/services/share_notification_service.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/dataall/modules/shares_base/services/share_notification_service.py b/backend/dataall/modules/shares_base/services/share_notification_service.py index 2efe8db69..bf86d4878 100644 --- a/backend/dataall/modules/shares_base/services/share_notification_service.py +++ b/backend/dataall/modules/shares_base/services/share_notification_service.py @@ -9,6 +9,7 @@ from dataall.base.context import get_context from dataall.modules.shares_base.services.shares_enums import ShareObjectStatus from dataall.modules.notifications.db.notification_repositories import NotificationRepository +from dataall.modules.datasets_base.db.dataset_models import DatasetBase log = logging.getLogger(__name__) @@ -34,7 +35,7 @@ class ShareNotificationService: - share.owner (person that opened the request) OR share.groupUri (if group_notifications=true) """ - def __init__(self, session, dataset, share: ShareObject): + def __init__(self, session, dataset: DatasetBase, share: ShareObject): self.dataset = dataset self.share = share self.session = session