Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dvc/command/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def _build_graph(self, target, commands, outs):
for out in stage.outs:
edges.append((str(out), str(dep)))
else:
for from_stage, to_stage in networkx.dfs_edges(G, target_stage):
for from_stage, to_stage in networkx.edge_dfs(G, target_stage):
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not a complaint or anything like that, but just wanted to say that this is actually a really good case where a PR/patch description would help understand the difference :) Just like a short note about "we are currently using dfs_edges, but it is not what we need because ... , so we need to use edge_dfs". Since you dove into researching this, your summary would have a great value πŸ™‚

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thats a valid point, Ill do that, it will probably be the best to include that in original issue, right?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@pared, could this be related with this: #3353?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@skshetry I don't think so. This issue was purely about dvc pipelines, and in #3353 throw happens upon reproduce. I would need to dive deeper into #3353 to say more.

if commands:
if to_stage.cmd is None:
continue
Expand Down
26 changes: 26 additions & 0 deletions tests/func/test_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,3 +237,29 @@ def locked_stage(self):

pipelines = self.dvc.pipelines
self.assertEqual(len(pipelines), 0)


def test_split_pipeline(tmp_dir, dvc):
tmp_dir.dvc_gen("data", "source file content")
dvc.run(
deps=["data"],
outs=["data_train", "data_valid"],
cmd="echo train >> data_train && echo valid >> data_valid",
)
stage = dvc.run(
deps=["data_train", "data_valid"],
outs=["result"],
cmd="echo result >> result",
)

command = CmdPipelineShow([])
nodes, edges, is_tree = command._build_graph(
stage.path, commands=False, outs=True
)
assert set(nodes) == {"data", "data_train", "data_valid", "result"}
assert set(edges) == {
("result", "data_train"),
("result", "data_valid"),
("data_train", "data"),
("data_valid", "data"),
}