-
Notifications
You must be signed in to change notification settings - Fork 590
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
ExecutionStore + MongoDB integration tests and fixes #5095
Merged
Merged
Changes from 12 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
9bd6bd3
estore int tests
ritch e7aa5c7
add get_store method
ritch 82c2707
add metadata and other util methods to estores
ritch 9db03e9
more estore cleanup
ritch c242324
remove impl details from estore unit tests
ritch 0d0ec4c
fix estore counting
ritch f65a6ad
additional estore count fixes
ritch a4db4a1
more global estore tests
ritch 8a26d6d
Update tests/unittests/decorators.py
ritch 62e578d
fix type def
ritch d15a088
remove unused yield
ritch f0d4db3
refactor drop_stores
ritch 044ddb5
remove test_dataset name
ritch 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 |
---|---|---|
|
@@ -36,6 +36,7 @@ def __init__( | |
self, | ||
repo: Optional["ExecutionStoreRepo"] = None, | ||
dataset_id: Optional[ObjectId] = None, | ||
collection_name: str = None, | ||
): | ||
|
||
from fiftyone.factory.repo_factory import ( | ||
|
@@ -45,12 +46,15 @@ def __init__( | |
|
||
if repo is None: | ||
repo = RepositoryFactory.execution_store_repo( | ||
dataset_id=dataset_id | ||
dataset_id=dataset_id, | ||
collection_name=collection_name, | ||
) | ||
|
||
self._dataset_id = dataset_id | ||
self._repo: ExecutionStoreRepo = repo | ||
|
||
def create_store(self, store_name: str) -> StoreDocument: | ||
def create_store( | ||
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. Same |
||
self, store_name: str, metadata: Optional[dict[str, Any]] = None | ||
) -> StoreDocument: | ||
"""Creates a new store with the specified name. | ||
|
||
Args: | ||
|
@@ -59,7 +63,18 @@ def create_store(self, store_name: str) -> StoreDocument: | |
Returns: | ||
a :class:`fiftyone.store.models.StoreDocument` | ||
""" | ||
return self._repo.create_store(store_name) | ||
return self._repo.create_store(store_name, metadata) | ||
|
||
def get_store(self, store_name: str) -> StoreDocument: | ||
"""Gets the specified store for the current context. | ||
|
||
Args: | ||
store_name: the name of the store | ||
|
||
Returns: | ||
a :class:`fiftyone.store.models.StoreDocument` | ||
""" | ||
return self._repo.get_store(store_name) | ||
|
||
def list_stores(self) -> list[str]: | ||
"""Lists all stores for the current context. | ||
|
@@ -116,6 +131,15 @@ def set_key( | |
""" | ||
return self._repo.set_key(store_name, key, value, ttl=ttl) | ||
|
||
def has_key(self, store_name: str, key: str) -> bool: | ||
"""Determines whether the specified key exists in the specified store. | ||
|
||
Args: | ||
store_name: the name of the store | ||
key: the key to check | ||
""" | ||
return self._repo.has_key(store_name, key) | ||
|
||
def get_key(self, store_name: str, key: str) -> KeyDocument: | ||
"""Retrieves the value of a key from the specified store. | ||
|
||
|
@@ -208,3 +232,15 @@ def count_stores_global(self) -> int: | |
the number of stores | ||
""" | ||
return self._repo.count_stores_global() | ||
|
||
def delete_store_global(self, store_name) -> int: | ||
"""Deletes the specified store across all datasets and the global | ||
context. | ||
|
||
Args: | ||
store_name: the name of the store | ||
|
||
Returns: | ||
the number of stores deleted | ||
""" | ||
return self._repo.delete_store_global(store_name) |
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.
I saw a PR where @imanjra plans to change this to
def store()
so just a heads up in case a conflict arises