-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Sort dvc pipeline list #2669
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
Sort dvc pipeline list #2669
Conversation
stages = nx.get_node_attributes(p, "stage") | ||
for node in p: | ||
stage = stages[node] | ||
# if not stage.locked: |
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.
Please don't leave commented-out code like that. Looks like you don't need it, right? If so - remove it.
for stage in stages: | ||
logger.info(stage) | ||
stages = nx.get_node_attributes(p, "stage") | ||
for node in p: |
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.
Please correct me if I'm wrong, but what you are doing here is you are walking through all nodes in the pipeline in the random order, then you do a dfs_postorder for each one of those and then just print it. This is basically the same as what it was before but now with a redundant step of dfs_postorder_nodes
. 🙂 Looks like we can do better than that 🙂
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.
Good way to think about it is to imagine how the pipeline looks. So it has a N start nodes (p.out_degree(node) == 0
), M end nodes (p.in_degree(node) == 0
) and some nodes between them. The way dvc repro --pipeline
works, is it finds all end nodes and for each of them does dfs_postorder_nodes
and just runs those. But obviously, that real order of execution is not going to look good here 🙁 Could we somehow order them better here? Maybe nx.topological_sort(p)
?
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.
Thank you for the explanation. I'll work on it.
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.
p.out_degree(node) == 0
for end nodes and p.in_degree(node) == 0
for start nodes right?
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.
@SrividyaKK Actually no, our DAG has a reversed shape right now because we put edges in the direction from dependent stage to the one it depends on. So say your pipeline is cleanup
step and then process
step, then DAG would look like cleanup <- process
. Just a caveat of the current design, we might change it in the future 😉
@SrividyaKK Need any help? 🙂 |
Closing due to inactivity. |
postorder traversal for issue #2588