-
Notifications
You must be signed in to change notification settings - Fork 79
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
Added parameters and exception behaviour to pqdm #792
base: main
Are you sure you want to change the base?
Conversation
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.
Thanks for your work on this PR @Sherwin-14!
There are still several places where you have to expose the new fail_fast
parameter. So far, you have added it only to "protected" methods, so it is not yet exposed to the user in the "public" function and methods. You need to keep following the call chains up to the top (public) API so that users can use the parameter, if they want to choose False
instead of the default True
.
For example, you added fail_fast
to Store._open_files
, but you have not added it to all places that call Store._open_files
. You did add it to Store._open_urls
, which calls _open_files
, but you did not yet add it to Store._open_granules
, which also calls _open_files
.
Further, both _open_files
and _open_granules
are dispatched when Store._open
is called, so you must find all places where Store._open
is called. In this case, it is called from Store.open
, which is a public method, so you must add fail_fast
to Store.open
so the user can override the default, if they wish.
Further still, Store.open
is called by the open
top-level function in the api
module, so you must add fail_fast
there as well.
You must follow all such call chains from all points where pqdm
is called, all the way up to the top of the call chains (up to the public functions and methods), adding fail_fast
to each function and method along all such call chains.
@mfisher87, I see lots of Ruff error messages regarding a number of files that @Sherwin-14 has not touched in this PR. Is there something already on |
Not yet, but that should be an easy fix. I'll take care of it now :) #788 |
Excellent! Thank you for the quick fix. @Sherwin-14, Matt's fix is now merged into |
@Sherwin-14, do you have enough information to proceed with the changes I requested? |
Yeah I have the info I needed, I had put this on hold since I was preoccupied with some other things for the last couple of days. I'll resume my work on this asap. |
Would it be possible and in scope of this PR to use # code in api.py and something similar in store.py
# in this example we leave threads out to ensure backwards compatibility and will use it in the store class if present
def open(granules, threads, provider, pqdm_opts):
default_pqdm_opts = {
n_jobs=threads,
exception_behaviour='immediate'
colour="green",
disable=False # True means no output including the progress bar.
}
if not pqdm_opts;
pqdm_opts = default_pqdm_opts
earthaccess.__store__.open(granules, treads, pqdm_opts) and actually we should do the same with |
@Sherwin-14 No rush! We really appreciate any time you can spare, and don't want to ask for more than that :) |
@betolink I really like that idea. Basically "Allow customizing all pqdm behaviors" (and separately, "Allow customizing all fsspec behaviors")? I'm not sure how I feel about including that as part of this PR. I lean towards separate out of respect for @Sherwin-14 's time, but I don't want to speak for you, Sherwin! |
We decided during hack day today that we want to allow users to customize pqdm behaviors like so: def open(something, threads=16, *, pqdm_kwargs={...}, ...):
pqdm_kwargs_defaults = {"exception_behavior": "immediate", "threads": threads}
pqdm_kwargs = pqdm_kwargs_defaults.update(pqdm_kwargs)
... We considered the |
How should we now proceed with the changes we discussed during the hackday? |
Do the same thing you did in the PR you already started for this, but instead of pqdm_kwargs = {
"exception_behavior": "immediate",
"n_jobs": threads,
**pqdm_kwargs,
}
...
pqdm(<other args>, **pqdm_kwargs) |
Great point! Much clearer with the double splat too ;) |
@Sherwin-14, do you need some help with this? |
I will try to accomodate the change asap, I was caught up in something else up untill now |
No rush. I just wanted to check in to see if you need any help or if something else was requiring you to postpone your continuation. |
I did all the steps outlined in the issue #581, we can now build upon this.
📚 Documentation preview 📚: https://earthaccess--792.org.readthedocs.build/en/792/