Skip to content

Commit

Permalink
auto-fallback on db if s3 not avail
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaume committed Dec 7, 2024
1 parent 6de5199 commit 8c1f6d1
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions mp_api/client/core/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -468,8 +468,6 @@ def _query_resource(
}
)
and num_chunks is None
and "substrates" not in self.suffix
and "phonon" not in self.suffix
)

if fields:
Expand Down Expand Up @@ -506,11 +504,22 @@ def _query_resource(

keys = []
for page in pages:
for obj in page["Contents"]:
for obj in page.get("Contents", []):
key = obj.get("Key")
if key:
keys.append(key)

if len(keys) < 1:
self._submit_requests(
url=url,
criteria=criteria,
use_document_model=use_document_model,
parallel_param=parallel_param,
num_chunks=num_chunks,
chunk_size=chunk_size,
timeout=timeout,
)

decoder = (
MontyDecoder().decode if self.monty_decode else json_util.loads
)
Expand Down

0 comments on commit 8c1f6d1

Please sign in to comment.