Skip to content

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

Closed
wants to merge 5 commits into from
Closed

Conversation

SrividyaKK
Copy link
Contributor

postorder traversal for issue #2588

stages = nx.get_node_attributes(p, "stage")
for node in p:
stage = stages[node]
# if not stage.locked:
Copy link
Contributor

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:
Copy link
Contributor

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 🙂

Copy link
Contributor

@efiop efiop Oct 25, 2019

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)?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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?

Copy link
Contributor

@efiop efiop Oct 28, 2019

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 😉

@efiop
Copy link
Contributor

efiop commented Nov 18, 2019

@SrividyaKK Need any help? 🙂

@efiop
Copy link
Contributor

efiop commented Nov 19, 2019

Closing due to inactivity.

@efiop efiop closed this Nov 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants