diff --git a/snakemake/workflow.py b/snakemake/workflow.py index 26f08aff6..afe4a5519 100644 --- a/snakemake/workflow.py +++ b/snakemake/workflow.py @@ -730,6 +730,9 @@ def files(items): or delete_temp_output, ) + if self.mode in [Mode.subprocess, Mode.cluster]: + self.persistence.deactivate_cache() + if cleanup_metadata: for f in cleanup_metadata: self.persistence.cleanup_metadata(f) diff --git a/tests/conftest.py b/tests/conftest.py index 9e23d4eab..2671d16ea 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -9,6 +9,7 @@ skip_on_windows = pytest.mark.skipif(ON_WINDOWS, reason="Unix stuff") only_on_windows = pytest.mark.skipif(not ON_WINDOWS, reason="Windows stuff") +needs_strace = pytest.mark.xfail(os.system("strace -o /dev/null true") != 0, reason="Missing strace") @pytest.fixture(autouse=True) diff --git a/tests/test_github_issue1158/Snakefile b/tests/test_github_issue1158/Snakefile new file mode 100644 index 000000000..ed1b7580b --- /dev/null +++ b/tests/test_github_issue1158/Snakefile @@ -0,0 +1,3 @@ +rule Test: + output: "output" + shell: "touch {output}" diff --git a/tests/test_github_issue1158/expected-results/output b/tests/test_github_issue1158/expected-results/output new file mode 100644 index 000000000..e69de29bb diff --git a/tests/test_github_issue1158/qsub.py b/tests/test_github_issue1158/qsub.py new file mode 100755 index 000000000..9e5c97093 --- /dev/null +++ b/tests/test_github_issue1158/qsub.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python3 +import sys +import os +import random +import re + +jobscript = sys.argv[1] + +os.system("strace -f -o trace {}".format(jobscript)) + +with open("trace", "r") as fp: + lines = fp.readlines() + +regex = re.compile('.*openat\(.*.snakemake/incomplete".*') +matches = list(filter(lambda l: regex.match(l), lines)) +if len(matches) > 0: + sys.stderr.write(repr(matches)) + sys.exit(1) + +print(random.randint(1, 100)) diff --git a/tests/tests.py b/tests/tests.py index 763a5f77b..0b887f4aa 100644 --- a/tests/tests.py +++ b/tests/tests.py @@ -12,7 +12,7 @@ sys.path.insert(0, os.path.dirname(__file__)) from .common import * -from .conftest import skip_on_windows, only_on_windows, ON_WINDOWS +from .conftest import skip_on_windows, only_on_windows, ON_WINDOWS, needs_strace def test_list_untracked(): @@ -1306,3 +1306,11 @@ def test_all_temp(): def test_strict_mode(): run(dpath("test_strict_mode"), shouldfail=True) + + +@needs_strace +def test_github_issue1158(): + run( + dpath("test_github_issue1158"), + cluster="./qsub.py", + )