diff --git a/snakemake/dag.py b/snakemake/dag.py index f6ef9b69d..e60eaa7c0 100755 --- a/snakemake/dag.py +++ b/snakemake/dag.py @@ -1040,7 +1040,7 @@ def update_needrun(job): if job_ not in visited: # TODO may it happen that order determines whether # _n_until_ready is incremented for this job? - if all(f.is_ancient for f in files): + if all(f.is_ancient and f.exists for f in files): # No other reason to run job_. # Since all files are ancient, we do not trigger it. continue diff --git a/tests/test_ancient_dag/Snakefile b/tests/test_ancient_dag/Snakefile new file mode 100644 index 000000000..b74c6872d --- /dev/null +++ b/tests/test_ancient_dag/Snakefile @@ -0,0 +1,39 @@ +shell.executable("bash") + +rule all: + input: + "d.out", + +rule A: + output: + "a.out", + shell: + "echo 'text' > {output}" + +rule B: + input: + ancient("a.out"), + output: + "b_{i}.out", + shell: + "cat {input} > {output}" + +# rule C is required for #946 +# use `range(20)` so test will pass in < 5% of cases where issue is present +rule C: + input: + expand("b_{i}.out", i=list(range(20))), + output: + "c.out", + shell: + "cat {input} > {output}" + +# For #946, 'a.out' is required as input, but does not need to be `ancient()` +rule D: + input: + "a.out", + "c.out", + output: + "d.out", + shell: + "cat {input} > {output}" diff --git a/tests/test_ancient_dag/expected-results/.gitkeep b/tests/test_ancient_dag/expected-results/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/tests/tests.py b/tests/tests.py index 9511a63d2..0223c0bc2 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -1320,3 +1320,7 @@ def test_github_issue1158(): dpath("test_github_issue1158"), cluster="./qsub.py", ) + + +def test_ancient_dag(): + run(dpath("test_ancient_dag"))