pipeline: fix --outs output (#3507)

Fixes #3497
This commit is contained in:
Ruslan Kuprieiev
2020-03-18 23:03:41 +02:00
committed by GitHub
parent 498ee509da
commit 7edee656da
2 changed files with 17 additions and 19 deletions
+11 -16
View File
@@ -48,26 +48,21 @@ class CmdPipelineShow(CmdBase):
elif outs:
for out in stage.outs:
nodes.add(str(out))
for dep in stage.deps:
nodes.add(str(dep))
else:
nodes.add(stage.relpath)
edges = []
if outs:
for stage in networkx.dfs_preorder_nodes(G, target_stage):
for dep in stage.deps:
for out in stage.outs:
edges.append((str(out), str(dep)))
else:
for from_stage, to_stage in networkx.edge_dfs(G, target_stage):
if commands:
if to_stage.cmd is None:
continue
edges.append((from_stage.cmd, to_stage.cmd))
else:
edges.append((from_stage.relpath, to_stage.relpath))
for from_stage, to_stage in networkx.edge_dfs(G, target_stage):
if commands:
if to_stage.cmd is None:
continue
edges.append((from_stage.cmd, to_stage.cmd))
elif outs:
for from_out in from_stage.outs:
for to_out in to_stage.outs:
edges.append((str(from_out), str(to_out)))
else:
edges.append((from_stage.relpath, to_stage.relpath))
return list(nodes), edges, networkx.is_tree(G)
+6 -3
View File
@@ -239,15 +239,18 @@ class TestDvcRepoPipeline(TestDvc):
self.assertEqual(len(pipelines), 0)
def test_split_pipeline(tmp_dir, dvc):
def test_split_pipeline(tmp_dir, scm, dvc):
tmp_dir.scm_gen("git_dep1", "git_dep1")
tmp_dir.scm_gen("git_dep2", "git_dep2")
tmp_dir.dvc_gen("data", "source file content")
dvc.run(
deps=["data"],
deps=["git_dep1", "data"],
outs=["data_train", "data_valid"],
cmd="echo train >> data_train && echo valid >> data_valid",
)
stage = dvc.run(
deps=["data_train", "data_valid"],
deps=["git_dep2", "data_train", "data_valid"],
outs=["result"],
cmd="echo result >> result",
)