-
Notifications
You must be signed in to change notification settings - Fork 82
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add delete docs not found when re indexing in catalog task #1365
Merged
+432
−50
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
721103b
Add delete docs not found when re indexing in catalog task
noah-paige 431669f
Add FE and API to start re index task
noah-paige 8d238f9
Clean up Catalog Service
noah-paige 6fa937a
Add module interface and fix imports
noah-paige bb111c4
fix import catalog indexers
noah-paige 4a25243
Fix Tests
noah-paige 91016ff
Conditional load on Catalog
noah-paige 6749fd4
Small fix SSM Param name
noah-paige acbf46d
Remove unused imports + fix descriptions
noah-paige e4590cd
updates reindex modal
noah-paige 0f27607
add test for catalog indexer with deletes true
noah-paige 8e68459
Add dep for dashboards and ruff
noah-paige File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/catalog_indexer', | ||
container_name_param='ecs/container/catalog_indexer', | ||
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
28 changes: 28 additions & 0 deletions
28
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,28 @@ | ||
import logging | ||
|
||
from dataall.base.context import get_context | ||
|
||
noah-paige marked this conversation as resolved.
Show resolved
Hide resolved
|
||
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__) | ||
|
||
|
||
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
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the
search
method could replace therun_query
frombackend/dataall/base/searchproxy/search.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it can but has larger implications / leaving it for now to keep scope of this PR targeted