Add isdag method to determine if a dask is a DAG, and add non-recursive get#12
Merged
mrocklin merged 7 commits intodask:masterfrom Feb 1, 2015
Merged
Conversation
…sive `get`. Both of these need better documentation and tests, but I wanted to share. `isdag` is a pretty standard DFS, which is stack-based (referring to data container), not recursive. The non-recursive `get` is only used when the "get" keyword isn't given. It can handle arbitrarily large graphs, because it is not limited by Python's recursion depth limit. It is also faster than the recursive method.
dask/core.py
Outdated
Contributor
There was a problem hiding this comment.
I think you're missing a return statement.
Member
Author
There was a problem hiding this comment.
Aha, I think the return statement got indented a level when I switched the function to work on a list of keys from a single key.
Member
Author
There was a problem hiding this comment.
return for this function is on line 86.
dask/core.py
Outdated
Member
Author
There was a problem hiding this comment.
Let's change this exception to either a dask-defined exception or a RuntimeError, which is what one would get with a recursive method.
Conflicts: dask/tests/test_core.py
…d cycle if not DAG. Also changed exception raised by non-recursive `get` to RuntimeError. This is the same error type that a recursive `get` would return (if `isdag` weren't checked). The exception is more informative and shows the nodes in the cycle.
mrocklin
added a commit
that referenced
this pull request
Feb 1, 2015
Add `isdag` method to determine if a dask is a DAG, and add non-recursive `get`
mrocklin
referenced
this pull request
in mrocklin/dask
Mar 28, 2019
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.
Both of these additions need better documentation and tests, but I wanted to share.
isdagis a pretty standard DFS, which is stack-based (referring to data container), not recursive.The non-recursive
getis only used when the "get" keyword isn't given. It can handle arbitrarily large graphs, because it is not limited by Python's recursion depth limit. It is also faster than the recursive method.