Repository navigation
Ensure we always raise for unknown backend in backend= - #7494
Conversation
This is like doing `backend=...` when calling a dispatchable function.
Previously, using `backend="foo"` would silently work if there were no backends installed. We should catch e.g. typos sooner.
|
I updated conftest.py so that the |
rlratzel
left a comment
There was a problem hiding this comment.
This looks good, I just have one request related to consistency.
Also, related to this PR, is a question that I want to make sure I know the answer to: what's the behavior (current and desired) when a user adds an unknown backend to the backend_priority list?
| - name: Test Dispatching | ||
| run: | | ||
| NETWORKX_TEST_BACKEND=nx-loopback pytest --doctest-modules --durations=10 --pyargs networkx | ||
| NETWORKX_TEST_BACKEND=nx_loopback pytest --doctest-modules --durations=10 --pyargs networkx |
There was a problem hiding this comment.
Our convention when specifying backends to networkx is to drop the nx- prefix used by the package name, so in this case it would be loopback (or at least that's how I've been explaining it to other users). This is also how the nx-cugraph backend is specified (as just cugraph) in the NETWORKX_BACKEND_PRIORITY env var and the backend= kwarg. Can we be consistent and change this to loopback?
There was a problem hiding this comment.
I've asked @dschult this before too. Let's keep it nx_loopback for now and at least until more of the dispatching PRs are merged, since this would make my life easier. I have WIP branches in flight that combine many of the PRs, so I would like to avoid unnecessary churn.
If we ever make loopback a "proper" backend that demonstrates how to be a backend--and one that tests networkx--then we should revisit the name.
Co-authored-by: Rick Ratzel <[email protected]>
Co-authored-by: Rick Ratzel <[email protected]>
| This is a global configuration. Use with caution when using from multiple threads. | ||
| """ | ||
|
|
||
| backend: str | None |
There was a problem hiding this comment.
This backend config is not needed for this PR, right?
I think this is a part of the PR that you made which adds backend="networkx".
Or am I missing something and this is needed here?
if we had used backend_priority = ["nx_loopback"], then I think it would have been sufficient for this PR.
Also, I think backends and backend can cause confusions, and a user can confuse backends with backend_priority. So, I think it might be nice to revisit my this comment #7485 (comment) in PR#7485 which proposed to combine the behaviour of backend and backend_priority. And I know you addressed it by saying that this would restrict how the both(backend and backend_priority) get developed in the future(but, I'm not completely sure how backend can grow further...). So, I am just trying to convey the point that we should name and define the functionalities of these parameters a little better.
There was a problem hiding this comment.
Good catch! I'll remove this.
This branch was originally based off of #7485, so this must have accidentally slipped through. I agree with not having nx.config.backend in this PR, because it needs more discussion. Perhaps we can discuss options at an nx dispatching meeting soon.
There was a problem hiding this comment.
Okay, I removed nx.config.backend from this PR 👍
Co-authored-by: Aditi Juneja <[email protected]>
Co-authored-by: Aditi Juneja <[email protected]>
mjschwenne
left a comment
There was a problem hiding this comment.
LGTM, and seems like useful and expected functionality.
Schefflera-Arboricola
left a comment
There was a problem hiding this comment.
Thanks @eriknw , @rlratzel and @mjschwenne :)
* Add `nx.config.backend` option This is like doing `backend=...` when calling a dispatchable function. * Add note to discuss the difference between `backend` and `backend_priority` * Ensure we always raise for unknown backend in `backend=` Previously, using `backend="foo"` would silently work if there were no backends installed. We should catch e.g. typos sooner. * Clean up (moved to separate PR) * Fix test, and rename `nx-loopback` to `nx_loopback` * s/nx-loopback/nx_loopback/ * oops fix bad merge * s/soft/best effort/ Co-authored-by: Rick Ratzel <[email protected]> * s/hard/strict/ Co-authored-by: Rick Ratzel <[email protected]> * "...backend is not installed" Co-authored-by: Aditi Juneja <[email protected]> * "...backend is not installed" (testing) Co-authored-by: Aditi Juneja <[email protected]> * Get rid of `nx.config.backend` (doesn't belong in this PR) * More "backend is not installed" updates --------- Co-authored-by: Rick Ratzel <[email protected]> Co-authored-by: Aditi Juneja <[email protected]>
Previously, using
backend="foo"would silently work if there were no backends installed. We should catch e.g. typos sooner.Note that I originally had this bugfix in #7485, but I think it's cleaner to have a separate PR with a test.