-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
355 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
from dataall.modules.catalog.handlers import ecs_catalog_handlers | ||
|
||
__all__ = ['ecs_catalog_handlers'] |
27 changes: 27 additions & 0 deletions
27
backend/dataall/modules/catalog/handlers/ecs_catalog_handlers.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import logging | ||
import os | ||
|
||
from dataall.core.tasks.service_handlers import Worker | ||
from dataall.core.stacks.aws.ecs import Ecs | ||
from dataall.core.tasks.db.task_models import Task | ||
from dataall.modules.catalog.tasks.catalog_indexer_task import CatalogIndexerTask | ||
|
||
log = logging.getLogger(__name__) | ||
|
||
|
||
class EcsCatalogIndexHandler: | ||
@staticmethod | ||
@Worker.handler(path='ecs.reindex.catalog') | ||
def run_ecs_reindex_catalog_task(engine, task: Task): | ||
envname = os.environ.get('envname', 'local') | ||
if envname in ['local', 'dkrcompose']: | ||
CatalogIndexerTask.index_objects(engine, str(task.payload.get('with_deletes', False))) | ||
else: | ||
ecs_task_arn = Ecs.run_ecs_task( | ||
task_definition_param='ecs/task_def_arn/share_management', | ||
container_name_param='ecs/container/share_management', | ||
context=[ | ||
{'name': 'with_deletes', 'value': str(task.payload.get('with_deletes', False))}, | ||
], | ||
) | ||
return {'task_arn': ecs_task_arn} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
backend/dataall/modules/catalog/services/catalog_service.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import logging | ||
|
||
from dataall.base.context import get_context | ||
from dataall.core.permissions.services.tenant_policy_service import TenantPolicyService | ||
|
||
from dataall.modules.catalog.db.glossary_repositories import GlossaryRepository | ||
from dataall.modules.catalog.db.glossary_models import GlossaryNode | ||
from dataall.modules.catalog.services.glossaries_permissions import MANAGE_GLOSSARIES | ||
from dataall.modules.catalog.indexers.registry import GlossaryRegistry | ||
from dataall.core.permissions.services.tenant_policy_service import TenantPolicyValidationService | ||
from dataall.core.tasks.db.task_models import Task | ||
from dataall.core.tasks.service_handlers import Worker | ||
|
||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
def _session(): | ||
return get_context().db_engine.scoped_session() | ||
|
||
|
||
class CatalogService: | ||
@staticmethod | ||
def start_reindex_catalog(with_deletes: bool) -> bool: | ||
context = get_context() | ||
groups = context.groups if context.groups is not None else [] | ||
if not TenantPolicyValidationService.is_tenant_admin(groups): | ||
raise Exception('Only data.all admin group members can start re-index catalog task') | ||
|
||
with context.db_engine.scoped_session() as session: | ||
reindex_catalog_task: Task = Task( | ||
action='ecs.reindex.catalog', targetUri='ALL', payload={'with_deletes': with_deletes} | ||
) | ||
session.add(reindex_catalog_task) | ||
|
||
Worker.queue(engine=context.db_engine, task_ids=[reindex_catalog_task.taskUri]) | ||
return True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.