Skip to content
Permalink
Browse files
fix: do not remove existing temp files in case of dryrun (#1543)
  • Loading branch information
johanneskoester committed Mar 31, 2022
1 parent 8628a3e commit e820f973ad8ca99822be69c927c7d7bf6a89f54e
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 2 deletions.
@@ -639,8 +639,11 @@ def unneeded_files():
yield from filterfalse(partial(needed, job), tempfiles)

for f in unneeded_files():
logger.info("Removing temporary output file {}.".format(f))
f.remove(remove_non_empty_dir=True)
if self.dryrun:
logger.info(f"Would remove temporary output {f}")
else:
logger.info("Removing temporary output {}.".format(f))
f.remove(remove_non_empty_dir=True)

def handle_log(self, job, upload_remote=True):
for f in job.log:
@@ -0,0 +1,20 @@
# Snakefile
rule all:
input:
"b.txt",


rule a:
output:
temp("a.txt"),
shell:
"touch a.txt"


rule b:
input:
"a.txt",
output:
"b.txt",
shell:
"touch b.txt"
Empty file.
Empty file.
@@ -1580,3 +1580,7 @@ def test_pipe_depend():
@skip_on_windows # no pipe support on windows
def test_pipe_depend_target_file():
run(dpath("test_pipe_depend"), targets=["test.txt"], shouldfail=True)


def test_github_issue1542():
run(dpath("test_github_issue1542"), dryrun=True)

0 comments on commit e820f97

Please sign in to comment.