Skip to content

Fall back to other backends on NotImplementedError - #7499

Closed
eriknw wants to merge 8 commits into
networkx:mainfrom
eriknw:networkx_fallback_notimplementederror
Closed

eriknw wants to merge 8 commits into
networkx:mainfrom
eriknw:networkx_fallback_notimplementederror

Conversation

@eriknw

@eriknw eriknw commented Jun 13, 2024

Copy link
Copy Markdown
Contributor

can_run and should_run may not be able to capture everything, so might as well try the next backend.

This also improves error and log messages to mention possible future behavior, and helps set us up for handling falling back via backend-to-backend conversions. #7496 will let us fall back to networkx before we support backend-to-backend conversions.

CC @rlratzel

eriknw added 2 commits June 13, 2024 22:06
`can_run` and `should_run` may not be able to capture everything,
so might as well try the next backend.
@eriknw eriknw added the Dispatching Related to dispatching and backend support label Jun 13, 2024
Comment on lines +815 to +816
f"{backend_names}. This may be supported via backend-to-backend "
"conversions in the future."

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor nit, nothing to block my approval: I think the original message was more succinct, and IMO mentioning backend-to-backend conversions here seems distracting. Perhaps instead is there some text that can be added to help the user resolve this problem if they were to get this error?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By including this in the text, it serves as a kind of warning or advertisement that it may be implemented in the future. Explaining how NotImplementedError behavior may be implemented seems like good practice to me--one that I would like to see more of.

How would you suggest users resolve this problem if they get this error?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interestingly, I also added a blurb to these messages in #7496. Do you like its verbiage better?

"Automatic conversions between backends may become possible in future releases."

@rlratzel

rlratzel commented Jul 3, 2024

Copy link
Copy Markdown
Contributor

This is a good change, thanks! I also really like the additional debug log messages.

@eriknw

eriknw commented Oct 1, 2024

Copy link
Copy Markdown
Contributor Author

Closing. Part of and superseded by #7585

@eriknw eriknw closed this Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Dispatching Related to dispatching and backend support type: Enhancements

Development

Successfully merging this pull request may close these issues.

2 participants