-
Notifications
You must be signed in to change notification settings - Fork 135
feat: support explicit bulk preloading (uproot-only) #1387
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
Conversation
| decompression_executor=None, | ||
| interpretation_executor=None, | ||
| delayed=uproot._util.unset, | ||
| preload=None, |
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.
I'd probably move this further up the list. Maybe after entry start and entry stop? We want this to be visible no?
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.
I didn't mean to mess with the order in case people pass positional args here - that would be a breaking change. Maybe coffea may want to force all of those options to be passed as kw-only at some point?
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.
Ohh yeah you're right about that. I guess I've never seen a person not pass kwargs that's why I said this. Indeed forcing kwargs would be best here from the coffea side.
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.
@lgray what do you think? Should we enforce kwargs in a separate PR? Should we just break the order here and not care? I've actually never seen anybody use positional args here because the first argument treepath is something that's never used because no one is actually passing in an uproot.reading.ReadOnlyDirectory to from_root.
`
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.
Ah - sorry for missing this. I would take it to a separate PR. I hope no one is actually using those and positional arguments though.
| preload (None or Callable): | ||
| A function to call to preload specific branches/columns in bulk. Only works in eager and virtual mode. | ||
| Passed to ``tree.arrays`` as the ``filter_branch`` argument to filter branches to be preloaded. |
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.
Same comment as above, I'd not put this in the end.
|
I like this @pfackeldey and have only left minor comments. I also like the fact that it is a callable like Is it possible to test something like this? I'm not sure because it's still gonna be a One request though, is it possible to fill out the access log during preloading? I think it's best to see what has been loaded (and that's also a unit test). If that involves moving the access_log around, that's fine. |
I didn't want to add them to the access_log, because it's an access-log and not a loaded-log. In my understanding, this should track what has been accessed through e.g. |
|
I think the access log is meant to keep track of which branches were read overall. The executors also report back the bytesread via the following: if isinstance(file, uproot.ReadOnlyDirectory):
metrics["bytesread"] = file.file.source.num_requested_bytesI may be miss-interpreting something though. |
|
I'm going to enable auto-merge on this one and we can fix the args/kwargs things before the next release. I've lodged this to-do in an Issue. |
This PR allows to bulk preload multiple branches with
NanoEventsFactory.from_root. This is useful to group multiple reads into a single request. In the virtual mode the preloaded branches are still kept virtual (wrapped essentially by a lambda) to delay evaluating the DSL until the field is actually needed, see:In addition you can trigger bulk loading of everything (single read request for all columns) in the eager mode as follows:
Currently, coffea reads with a single request per column.