-
Notifications
You must be signed in to change notification settings - Fork 89
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
refactor: implement Backend
registry (2 of 2)
#2390
Conversation
f28d0ac
to
fb42f0c
Compare
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.
This is a good internal refactoring, but as a question that must be answered before merging: is this going to affect the Coffea and dask-awkward updates?
Coffea might be using L3 nplike/backend resolution as a stepping stone during development (it has to eventually all be L2, but can be L3 while figuring out what needs to be done, independent of how to interface with it properly).
With this PR, do the Coffea tests still work?
fb42f0c
to
ac56c37
Compare
ff4e999
to
a62c587
Compare
Codecov Report
Additional details and impacted files
|
For my local install, I'll ping @lgray to figure out whether I should be testing a different branch to |
@agoose77 let me check - there are some xfails right now because of some strange interactions with dask that are not your fault which I have not marked. |
@agoose77 coffea main should now pass tests if everything is ok. :-) |
I ran coffea's test suite (and dask-awkward) on this branch, and saw no regressions :) Merging! |
TL;DR
#2389 implements a cached lookup for nplikes. This PR implements a similar mechanism for backends. Unlike #2389, this PR implements a lookup registry; types can register a factory function that accepts a type, and returns a finder. This is used to locate backends for e.g.
Content
.TL
This PR intends to clarify which objects support
Backend
resolution, and to improve the performance of the search. Although the existing mechanism is trivial, it is called frequently throughout the codebase, so it is important to keep it simple.The existing implementation attempts to duck-type our way to find the backends. However, in practice we are constrained in what kind of interface we can define, such that this approach is not scalable.
This PR replaces kludgy logic with an explicit lookup mechanism that can be specialised per type.