Skip to content

Commit

Permalink
fix: throw error message in case of target rule that depends on a pip…
Browse files Browse the repository at this point in the history
…e. (#1532)

* fix: throw error message in case of target rule that depends on a pipe.

* skip on win
  • Loading branch information
johanneskoester committed Mar 30, 2022
1 parent 99b22d3 commit b9e9a7e
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 0 deletions.
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
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 b9e9a7e

Please sign in to comment.