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
Allow backends to implement should_run
#7257
Conversation
I don't think we should restrict it to cases where a conversion would be done. I think we should allow backend developers the freedom to communicate that they may be too slow, buggy, experimental, etc. for specific operations/corner cases even if the graph is already converted. Of course, the backend should also be able to see if a conversion would be required or not and use that to influence its decision too. The "reason" string is crucial here for a good UX (and I think it should be required). clarification: if |
@eriknw and I met offline and discussed that this PR could be merged with the policy in place to only consider Merging it now will allow |
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 looks like a possibly useful feature depending on whether the developers understand it well and implement it well. But that is true for all code:)
I'm approving this -- but given the discussion today, if you want to delay merging it that is fine with me too.
Thanks @dschult! I think this is good to go in. It shouldn't hurt anything, and it gives backends a chance to improve UX (if they return False for IIRC, we'll want to do more with this in the future (such as using the returned string in logging, warning, or introspection), and we said this PR isn't a "must have" for 3.3, but I think it's still "nice to have". @rlratzel am I missing anything? If nothing else, it's good to get this in so it's easier for me to refactor the dispatching code :) |
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.
* Allow backends to implement `should_run` * Handle str return types for `can_run` and `should_run`
As discussed in the weekly dispatching call (and first proposed by @rlratzel I believe), this PR adds
should_run
that is likecan_run
, but answers whether the backend should be called (converting if necessary).Right now, this only applies to when networkx graphs would be converted to backend graphs before running the networkx algorithm, so it would be accurate to call it
should_convert_and_run
, but that's wordy, and we'll probably add more sophisticated things soon such as caching and backend-to-backend conversions, soshould_run
is more generically accurate and useful.should_run
does not get used...backend=...
is given