Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix: run dependencies with non-existent ancient files before the cons…
…uming job (#1202)

Fixes #946

Co-authored-by: Johannes Köster <johannes.koester@uni-due.de>
  • Loading branch information
DonFreed and johanneskoester committed Oct 21, 2021
1 parent 313de93 commit 84d1f64
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 1 deletion.
2 changes: 1 addition & 1 deletion snakemake/dag.py
Expand Up @@ -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
Expand Down
39 changes: 39 additions & 0 deletions 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}"
Empty file.
4 changes: 4 additions & 0 deletions tests/tests.py
Expand Up @@ -1320,3 +1320,7 @@ def test_github_issue1158():
dpath("test_github_issue1158"),
cluster="./qsub.py",
)


def test_ancient_dag():
run(dpath("test_ancient_dag"))

0 comments on commit 84d1f64

Please sign in to comment.