-
-
Notifications
You must be signed in to change notification settings - Fork 16
[#441] [IMPROVE] Preload embedding model at startup #461
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
Open
sahilds1
wants to merge
21
commits into
CodeForPhilly:develop
Choose a base branch
from
sahilds1:441-embedding-models
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
59b40f0
REFACTOR Pull apart get_closest_embeddings to make testing easier
sahilds1 3ffb74a
ADD Add infra required to run pytest
sahilds1 12b09a7
ADD Start adding tests for embedding_services"
sahilds1 da9afaa
DOC Add a note about running pytest in the README
sahilds1 5ce7782
Preload SentenceTransformer model at Django startup before traffic is…
sahilds1 50a8bd3
Merge branch 'develop' into 441-embedding-models
sahilds1 795f218
Run python-app workflow on pushes and PRs to develop branch
sahilds1 d498a00
Pytest won’t automatically discover config files in subdirectories
sahilds1 6d3d8d1
Merge branch 'develop' into 441-embedding-models
sahilds1 3824d81
Suppress E402 import violations
sahilds1 46e9969
Add build_query tests and document coverage gaps in embedding_services
sahilds1 64a19ef
Fill test gaps in test_embedding_services
sahilds1 dec3c12
Fix incorrect build_query test assertions
sahilds1 f9e890a
Guard TransformerModel preload to runserver processes only
sahilds1 67176a8
Revert GitHub Workflow changes
sahilds1 d273921
Add section header comments to all four test groups in test_embedding…
sahilds1 8198574
Document why tests are split by responsibility
sahilds1 5d8c8b3
Improve logging and comments
sahilds1 31498dc
Fall back to lazy load using try except block
sahilds1 a39d33c
Revert settings.py to develop state
sahilds1 fe1eeca
Manually test fall back to lazy loading
sahilds1 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 hidden or 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 hidden or 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 hidden or 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.
build_query()introduces/relocates important filtering + precedence logic (authenticated vs unauthenticated visibility; guid-over-document_name; LIMIT slicing), but the new tests only coverevaluate_queryandlog_usage. Add unit/integration tests coveringbuild_querybehavior (e.g., guid precedence and the authenticated/unauthenticated queryset filters) to prevent regressions in access control and filtering.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.
Building on Copilot's comment, the specifics of the
QuerySetobject's structure aren't publicly documented. To inspect theQuerySets, we should actually execute them.There's a couple ways we handle DB access for these tests. We could use [
pytest-django's ``@pytest.mark.django_db](https://pytest-django.readthedocs.io/en/latest/database.html), which wraps the test in a transaction the rolls back automatically afterwards. Django also has a built-indjango.test.TestCase`, which does a similar thing.Uh oh!
There was an error while loading. Please reload this page.
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.
Thanks for sharing the docs references -- I added tests for
build_queryand didn't have to access the database because I was able to inspect which methods and arguments were called on the model ("Embeddings")