Skip to content
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

Revert store close apart from S3 #818

Merged
merged 3 commits into from Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 0 additions & 6 deletions src/maggma/api/resource/post_resource.py
Expand Up @@ -13,7 +13,6 @@
from maggma.api.utils import STORE_PARAMS, merge_queries
from maggma.core import Store
from maggma.stores import S3Store
from maggma.core.store import StoreError


class PostOnlyResource(Resource):
Expand Down Expand Up @@ -145,11 +144,6 @@ def search(**queries: Dict[str, STORE_PARAMS]) -> Dict:
detail="Server timed out trying to obtain data. Try again with a smaller request, "
"or remove sorting fields and sort data locally.",
)
try:
self.store.close()
except (StoreError, AttributeError):
# If no connections are present, then move on
pass

operator_meta = {}

Expand Down
13 changes: 0 additions & 13 deletions src/maggma/api/resource/read_resource.py
Expand Up @@ -15,7 +15,6 @@
from maggma.api.utils import STORE_PARAMS, merge_queries, serialization_helper
from maggma.core import Store
from maggma.stores import MongoStore, S3Store
from maggma.core.store import StoreError

import orjson

Expand Down Expand Up @@ -169,12 +168,6 @@ def get_by_key(
detail=f"Item with {self.store.key} = {key} not found",
)

try:
self.store.close()
except (StoreError, AttributeError):
# If no connections are present, then move on
pass

for operator in self.query_operators:
item = operator.post_process(item, {})

Expand Down Expand Up @@ -280,12 +273,6 @@ def search(**queries: Dict[str, STORE_PARAMS]) -> Union[Dict, Response]:
" or remove sorting fields and sort data locally.",
)

try:
self.store.close()
except (StoreError, AttributeError):
# If no connections are present, then move on
pass

operator_meta = {}

for operator in self.query_operators:
Expand Down
7 changes: 0 additions & 7 deletions src/maggma/api/resource/s3_url.py
Expand Up @@ -10,7 +10,6 @@
from maggma.api.resource import Resource, HeaderProcessor
from maggma.api.utils import serialization_helper
from maggma.stores.aws import S3Store
from maggma.core.store import StoreError

import orjson

Expand Down Expand Up @@ -115,12 +114,6 @@ def get_by_key(
),
)

try:
self.store.close()
except (StoreError, AttributeError):
# If no connections are present, then move on
pass

requested_datetime = datetime.utcnow()
expiry_datetime = requested_datetime + timedelta(seconds=self.url_lifetime)

Expand Down
13 changes: 0 additions & 13 deletions src/maggma/api/resource/submission.py
Expand Up @@ -16,7 +16,6 @@
from maggma.api.utils import STORE_PARAMS, merge_queries
from maggma.core import Store
from maggma.stores import S3Store
from maggma.core.store import StoreError


class SubmissionResource(Resource):
Expand Down Expand Up @@ -175,12 +174,6 @@ def get_by_key(
detail=f"Item with submission ID = {key} not found",
)

try:
self.store.close()
except (StoreError, AttributeError):
# If no connections are present, then move on
pass

for operator in self.get_query_operators: # type: ignore
item = operator.post_process(item, {})

Expand Down Expand Up @@ -262,12 +255,6 @@ def search(**queries: STORE_PARAMS):
"or remove sorting fields and sort data locally.",
)

try:
self.store.close()
except (StoreError, AttributeError):
# If no connections are present, then move on
pass

meta = Meta(total_doc=count)

for operator in self.get_query_operators: # type: ignore
Expand Down