-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
repro: fix bug in _get_active_graph (#3301)
We are currently removing all of the deps stages from the DAG even if those deps are referenced by some parallel branches of execution. The new approach is to remove edges and then gradually remove nodes if there are no more `in` edges left. Discord context: https://discordapp.com/channels/485586884165107732/485596304961962003/676464313942409265
- Loading branch information
Showing
3 changed files
with
37 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
File renamed without changes.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from dvc.repo.reproduce import _get_active_graph | ||
|
||
|
||
def test_get_active_graph(tmp_dir, dvc): | ||
pre_foo_stage, = tmp_dir.dvc_gen({"pre-foo": "pre-foo"}) | ||
foo_stage = dvc.run(deps=["pre-foo"], outs=["foo"], cmd="echo foo > foo") | ||
bar_stage = dvc.run(deps=["foo"], outs=["bar"], cmd="echo bar > bar") | ||
baz_stage = dvc.run(deps=["foo"], outs=["baz"], cmd="echo baz > baz") | ||
|
||
dvc.lock_stage("bar.dvc") | ||
|
||
graph = dvc.graph | ||
active_graph = _get_active_graph(graph) | ||
assert active_graph.nodes == graph.nodes | ||
assert set(active_graph.edges) == { | ||
(foo_stage, pre_foo_stage), | ||
(baz_stage, foo_stage), | ||
} | ||
|
||
dvc.lock_stage("baz.dvc") | ||
|
||
graph = dvc.graph | ||
active_graph = _get_active_graph(graph) | ||
assert set(active_graph.nodes) == {bar_stage, baz_stage} | ||
assert not active_graph.edges |