Skip to content

Bugfix: client batch retrieval without results#1077

Open
esoteric-ephemera wants to merge 3 commits intomainfrom
egregious-logs
Open

Bugfix: client batch retrieval without results#1077
esoteric-ephemera wants to merge 3 commits intomainfrom
egregious-logs

Conversation

@esoteric-ephemera
Copy link
Copy Markdown
Collaborator

  • Fixing bugs in client which would lead to infinite recursion in retrieving no results:
from mp_api.client import MPRester

with MPRester() as mpr:
   mpr.materials.summary.search(material_ids=[f"mp-{idx+1}" for idx in range(100)],deprecated = True)

will infinitely recur because the client will try to recursively batch any requests that return 0 results

If an input query is malformed and the client "silently ignores" such a malformed query, we should be solving that by correctly formatting the query and not relying on batching to solve it

  • Remove progress bars when results are empty
  • Ensure that the batch size is actually the maximum batch size set in the client (100) and not 10

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.85714% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 86.62%. Comparing base (a08a927) to head (d2f3545).

Files with missing lines Patch % Lines
mp_api/client/core/client.py 83.33% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1077      +/-   ##
==========================================
- Coverage   86.82%   86.62%   -0.21%     
==========================================
  Files          47       47              
  Lines        2680     2684       +4     
==========================================
- Hits         2327     2325       -2     
- Misses        353      359       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants