Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Disable Persistence cache for snakemake jobs #1159

Merged
merged 4 commits into from Sep 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions snakemake/workflow.py
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions tests/conftest.py
Expand Up @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions tests/test_github_issue1158/Snakefile
@@ -0,0 +1,3 @@
rule Test:
output: "output"
shell: "touch {output}"
Empty file.
20 changes: 20 additions & 0 deletions 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))
10 changes: 9 additions & 1 deletion tests/tests.py
Expand Up @@ -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():
Expand Down Expand Up @@ -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",
)