Skip to content

Commit

Permalink
fix issue #1028. (#1094)
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneskoester committed Jul 16, 2021
1 parent a8241b9 commit 3530f32
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 1 deletion.
9 changes: 8 additions & 1 deletion snakemake/scheduler.py
Expand Up @@ -641,7 +641,14 @@ def job_selector_ilp(self, jobs):
for idx, job in enumerate(jobs)
}

size_gb = lambda f: f.size / 1e9
def size_gb(f):
if self.touch:
# In case of touch mode, there is no need to prioritize based on size.
# We cannot access it anyway, because the files might be temporary and
# not present.
return 0
else:
return f.size / 1e9

temp_files = {
temp_file for job in jobs for temp_file in self.dag.temp_input(job)
Expand Down
16 changes: 16 additions & 0 deletions tests/test_touch_pipeline_with_temp_dir/Snakefile
@@ -0,0 +1,16 @@
rule all:
input: "out.txt"

rule input:
output: temp("tmp.txt")
run:
with open(f"{output}", "w") as output:
print("tmp", file=output)

rule intemediate:
input: "tmp.txt"
output: "out.txt"
run:
with open(f"{input}") as input:
with open(f"{output}", "w") as output:
print(*input.readlines(), file=output)
@@ -0,0 +1,2 @@
tmp

2 changes: 2 additions & 0 deletions tests/test_touch_pipeline_with_temp_dir/out.txt
@@ -0,0 +1,2 @@
tmp

5 changes: 5 additions & 0 deletions tests/tests.py
Expand Up @@ -1277,3 +1277,8 @@ def test_github_issue1069():
dpath("test_github_issue1069"),
shellcmd="snakemake -c1 --resources mem_mb=16423",
)


def test_touch_pipeline_with_temp_dir():
# Issue #1028
run(dpath("test_touch_pipeline_with_temp_dir"), forceall=True, touch=True)

0 comments on commit 3530f32

Please sign in to comment.