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

[Bug]: The MPRester.get_entries method always returns duplicated results #841

Closed
2 of 4 tasks
goodwilling opened this issue Sep 10, 2023 · 3 comments
Closed
2 of 4 tasks
Labels
bug Something isn't working

Comments

@goodwilling
Copy link

Email (Optional)

No response

Version

v0.35.1

Which OS(es) are you using?

  • MacOS
  • Windows
  • Linux

What happened?

The MPRester.get_entries method always returns duplicated results. For example, the following script returns 3 entries for mp-149. It will be convenient if duplicated entries are removed in the results of get_entries. Thank you very much.

Code snippet

from mp_api.client import MPRester
mpr = MPRester("32-digit API key")
entry = mpr.get_entries("mp-149")
print(len(entry))

Log output

UserWarning: mpcontribs-client not installed. Install the package to query MPContribs data, or construct pourbaix diagrams: 'pip install mpcontribs-client'

3

Code of Conduct

  • I agree to follow this project's Code of Conduct
@goodwilling goodwilling added the bug Something isn't working label Sep 10, 2023
@munrojm
Copy link
Member

munrojm commented Sep 12, 2023

@goodwilling thanks for bringing this up, I will take a closer at look at what might be causing this.

@goodwilling
Copy link
Author

Thanks. After some tests, it is found that the duplicated results can be removed, if parallel_param = None is explicitly set in mp_api/client/core/client.py:

def _submit_requests(

    # Generate new sets of criteria dicts to be run in parallel
    # with new appropriate limit values. New limits obtained from
    # trying to evenly divide num_chunks by the total number of new
    # criteria dicts.
    **_parallel_param = None_**
	
if parallel_param is not None:
        # Determine slice size accounting for character maximum in HTTP URL
        # First get URl length without parallel param

@munrojm
Copy link
Member

munrojm commented Sep 27, 2023

@goodwilling this is helpful. Was delayed updating a bunch of our packages to support pydantic 2.0, but will look at this today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants