Skip to content

Commit

Permalink
Merge branch 'main' of github.com:snakemake/snakemake
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneskoester committed Mar 30, 2022
2 parents 76159ae + b9e9a7e commit b725cd1
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 4 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/main.yml
Expand Up @@ -57,7 +57,9 @@ jobs:
conda install -c conda-forge -q mamba
mamba env create -q --name snakemake --file test-environment.yml
# additionally add singularity
mamba install -c conda-forge -n snakemake singularity
# TODO remove version constraint: needed because 3.8.7 fails with missing libz:
# bin/unsquashfs: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory
mamba install -c conda-forge -n snakemake "singularity<=3.8.6"
- name: Setup apt dependencies
run: |
Expand Down
4 changes: 3 additions & 1 deletion misc/vim/syntax/snakemake.vim
Expand Up @@ -47,8 +47,10 @@ source $VIMRUNTIME/indent/python.vim
syn keyword pythonStatement include workdir onsuccess onerror onstart
syn keyword pythonStatement ruleorder localrules configfile group
syn keyword pythonStatement wrapper conda shadow
syn keyword pythonStatement input output params wildcards priority message threads resources singularity wildcard_constraints
syn keyword pythonStatement input output params wildcards priority message
syn keyword pythonStatement threads resources singularity container wildcard_constraints
syn keyword pythonStatement version run shell benchmark snakefile log script
syn keyword pythonStatement default_target template_engine
syn keyword pythonStatement rule subworkflow checkpoint nextgroup=pythonFunction skipwhite
syn keyword pythonBuiltinObj config checkpoints rules
syn keyword pythonBuiltinFunc directory ancient pipe unpack expand temp touch protected
Expand Down
6 changes: 6 additions & 0 deletions snakemake/dag.py
Expand Up @@ -1308,6 +1308,12 @@ def handle_pipes_and_services(self):
"a dead lock.".format(f),
rule=job.rule,
)
elif is_pipe and depending[0].is_norun:
raise WorkflowError(
f"Output file {f} is marked as pipe but is requested by a rule that "
"does not execute anything. This is not allowed because it would lead "
"to a dead lock."
)

for dep in depending:
if dep.is_run:
Expand Down
4 changes: 3 additions & 1 deletion snakemake/deployment/conda.py
Expand Up @@ -564,7 +564,9 @@ def __init__(self, container_img=None, prefix_path=None):

if prefix_path is None or container_img is not None:
self.prefix_path = json.loads(
shell.check_output(self._get_cmd("conda info --json"))
shell.check_output(
self._get_cmd("conda info --json"), universal_newlines=True
)
)["conda_prefix"]
else:
self.prefix_path = prefix_path
Expand Down
3 changes: 2 additions & 1 deletion snakemake/workflow.py
Expand Up @@ -392,7 +392,8 @@ def norm_rule_relpath(f, rule):
)
else:
raise WorkflowError(
"Error executing git:\n{}".format(e.stderr.decode())
"Error executing git (Snakemake requires git to be installed for "
"remote execution without shared filesystem):\n" + e.stderr.decode()
)

return files
Expand Down
11 changes: 11 additions & 0 deletions tests/test_pipe_depend/Snakefile
@@ -0,0 +1,11 @@
rule all:
input:
"test.txt"


rule a:
output:
pipe("test.txt")
shell:
"echo test > {output}"

Empty file.
10 changes: 10 additions & 0 deletions tests/tests.py
Expand Up @@ -1565,3 +1565,13 @@ def test_service_jobs():

def test_incomplete_params():
run(dpath("test_incomplete_params"), dryrun=True, printshellcmds=True)


@skip_on_windows # no pipe support on windows
def test_pipe_depend():
run(dpath("test_pipe_depend"), shouldfail=True)


@skip_on_windows # no pipe support on windows
def test_pipe_depend_target_file():
run(dpath("test_pipe_depend"), targets=["test.txt"], shouldfail=True)

0 comments on commit b725cd1

Please sign in to comment.