Repository navigation
Log "can/should run" and caching in dispatch machinery - #7568
Merged
Merged
Conversation
Contributor
Author
Schefflera-Arboricola
left a comment
Member
There was a problem hiding this comment.
Thanks @eriknw :)
Comment on lines
+959
to
+961
| _logger.debug( | ||
| "Backend '%s' does not implement `%s'", backend_name, self.name | ||
| ) |
There was a problem hiding this comment.
Do we want to log it and also raise an exception here? isn't the error msg sufficient?
>>> nx.degree_centrality(G, backend="parallel")
Backend 'parallel' does not implement `degree_centrality'
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/workspaces/networkx/networkx/utils/decorators.py", line 789, in func
return argmap._lazy_compile(__wrapper)(*args, **kwargs)
File "<class 'networkx.utils.decorators.argmap'> compilation 29", line 3, in argmap_degree_centrality_26
File "/workspaces/networkx/networkx/utils/backends.py", line 911, in __call__
return self._convert_and_call(
File "/workspaces/networkx/networkx/utils/backends.py", line 1371, in _convert_and_call
raise RuntimeError(msg)
RuntimeError: 'degree_centrality' not implemented by parallel
Contributor
Author
There was a problem hiding this comment.
Hmm, that duplication is kind of unfortunate. Nice attention to detail.
I just pushed a change that doesn't write that log message when that exception will be raised. The log message may have info that doesn't show up in the warnings--specifically, the string returned by can_run--so maybe a little duplication is okay if the log message may be more helpful.
Co-authored-by: Aditi Juneja <[email protected]>
Co-authored-by: Aditi Juneja <[email protected]>
rlratzel
approved these changes
Aug 1, 2024
Schefflera-Arboricola
approved these changes
Aug 11, 2024
MridulS
approved these changes
Aug 25, 2024
MridulS
left a comment
Member
There was a problem hiding this comment.
Not a blocker for this PR but we really need to find good ways to test the backends.py file.
rossbar
pushed a commit
to Peiffap/networkx
that referenced
this pull request
Sep 6, 2024
* Log "can run" and "should run" in dispatch machinery * Also add logging for using cache * Make code more concise by combining branches for `should_run` Co-authored-by: Aditi Juneja <[email protected]> * Make code more concise by combining branches for `can_run` Co-authored-by: Aditi Juneja <[email protected]> * Don't log if info also in error message * Log when falling back to networkx too --------- Co-authored-by: Aditi Juneja <[email protected]> Co-authored-by: Mridul Seth <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds informative logging messages for
can_runandshould_runto better understand behaviors of dispatching.