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

--use-ingularity breaks shadow usage in non-singularity rules #78

Closed
giesselmann opened this issue Nov 1, 2019 · 3 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@giesselmann
Copy link

Snakemake version
5.7.4

Describe the bug
In a workflow with some rules using singularity and some not, the ones without singularity container will not switch into a shadow directory if the workflow is executed with --use-singularity.

Logs
running the minimal example with snakemake all produces the correct
test.out, test_a.out, test-b.out and test_c.out

running the minimal example with snakemake --use-singularity -k all fails in rule_b and rule_c and produces:
test_a.out, junk_b.out, junk_c.out

Minimal example
Consider the following example

rule all:
    input: "test.out"

rule singularity_ok:
    input:
        "test_a.out",
        "test_b.out",
        "test_c.out"
    output:
        touch("test.out")
    shell:
        """
        test ! -f junk_a.out
        test ! -f junk_b.out
        test ! -f junk_c.out
        """

rule a:
    output:
        "test_a.out"
    singularity:
        "docker://bash"
    shadow:
        "minimal"
    shell:
        'echo 1 > junk_a.out; echo "test" > {output}'

rule b:
    output:
        "test_b.out"
    shadow:
        "minimal"
    shell:
        'echo 1 > junk_b.out; echo "test" > {output}'

rule c:
    output:
        "test_c.out"
    shadow:
        "minimal"
    run:
        with open(output[0], 'w') as fp:
            print("test", file=fp)
        with open('junk_c.out', 'w') as fp:
            print("junk", file=fp)

Additional context
I played a bit around, seems to be related to code in executor.py:

# Change workdir if shadow defined and not using singularity.
# Otherwise, we do the change from inside the container.
passed_shadow_dir = None
if use_singularity and job_rule.singularity_img:
    passed_shadow_dir = shadow_dir
    shadow_dir = None

This is a duplicate of issue 1280 in the bitbucket repo.

Pay

@giesselmann giesselmann added the bug Something isn't working label Nov 1, 2019
johanneskoester added a commit that referenced this issue Nov 5, 2019
@johanneskoester johanneskoester self-assigned this Nov 5, 2019
@johanneskoester
Copy link
Contributor

Thanks for reporting! Should be fixed by PR #89.

@giesselmann
Copy link
Author

Thank you for the prompt reaction. And for the great software!

johanneskoester added a commit that referenced this issue Nov 5, 2019
* resolve issue #78 and add test case

* fmt
@johanneskoester
Copy link
Contributor

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants