Skip to content
Permalink
Browse files
fix: Disable Persistence cache for snakemake jobs (#1159)
* Implement test_github_issue1158

* Disable Persistence cache for snakemake jobs

* test_github_issue1158 mark xfail if no strace

* Add tests/test_github_issue1158/expected-results
  • Loading branch information
veprbl committed Sep 5, 2021
1 parent ac3274a commit 7110f9d2e7ee3f350bd1da3c5b4aab98c06725a1
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 1 deletion.
@@ -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)
@@ -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)
@@ -0,0 +1,3 @@
rule Test:
output: "output"
shell: "touch {output}"
Empty file.
@@ -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))
@@ -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",
)

0 comments on commit 7110f9d

Please sign in to comment.