-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Improve indexing status display #278
Merged
+314
−20
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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
36 changes: 36 additions & 0 deletions
36
backend/alembic/versions/5e84129c8be3_add_docs_indexed_column_to_index_.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,36 @@ | ||
"""Add docs_indexed_column + time_started to index_attempt table | ||
|
||
Revision ID: 5e84129c8be3 | ||
Revises: e6a4bbc13fe4 | ||
Create Date: 2023-08-10 21:43:09.069523 | ||
|
||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = "5e84129c8be3" | ||
down_revision = "e6a4bbc13fe4" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
op.add_column( | ||
"index_attempt", | ||
sa.Column("num_docs_indexed", sa.Integer()), | ||
) | ||
op.add_column( | ||
"index_attempt", | ||
sa.Column( | ||
"time_started", | ||
sa.DateTime(timezone=True), | ||
nullable=True, | ||
), | ||
) | ||
|
||
|
||
def downgrade() -> None: | ||
op.drop_column("index_attempt", "time_started") | ||
op.drop_column("index_attempt", "num_docs_indexed") |
32 changes: 32 additions & 0 deletions
32
backend/alembic/versions/e6a4bbc13fe4_add_index_for_retrieving_latest_index_.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,32 @@ | ||
"""Add index for retrieving latest index_attempt | ||
|
||
Revision ID: e6a4bbc13fe4 | ||
Revises: b082fec533f0 | ||
Create Date: 2023-08-10 12:37:23.335471 | ||
|
||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = "e6a4bbc13fe4" | ||
down_revision = "b082fec533f0" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade() -> None: | ||
op.create_index( | ||
op.f("ix_index_attempt_latest_for_connector_credential_pair"), | ||
"index_attempt", | ||
["connector_id", "credential_id", "time_created"], | ||
unique=False, | ||
) | ||
|
||
|
||
def downgrade() -> None: | ||
op.drop_index( | ||
op.f("ix_index_attempt_latest_for_connector_credential_pair"), | ||
table_name="index_attempt", | ||
) |
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 |
---|---|---|
|
@@ -88,6 +88,7 @@ def _delete_singly_indexed_docs() -> int: | |
return num_docs_deleted | ||
|
||
num_docs_deleted = _delete_singly_indexed_docs() | ||
logger.info(f"Deleted {num_docs_deleted} documents from document stores") | ||
|
||
def _update_multi_indexed_docs() -> None: | ||
# if a document is indexed by multiple connector_credential_pairs, we should | ||
|
@@ -132,8 +133,8 @@ def _get_user( | |
# categorize into groups of updates to try and batch them more efficiently | ||
update_groups: dict[tuple[str, ...], list[str]] = {} | ||
for document_id, allowed_users_lst in document_id_to_allowed_users.items(): | ||
# if document_id in document_ids_not_needing_update: | ||
# continue | ||
if document_id in document_ids_not_needing_update: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should not have been commented out previously 😓 |
||
continue | ||
|
||
allowed_users_lst.remove(to_be_deleted_user) | ||
allowed_users = tuple(sorted(set(allowed_users_lst))) | ||
|
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.
what is ix?