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: throw error message in case of target rule that depends on a pipe. #1532

Merged
merged 4 commits into from Mar 30, 2022
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
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)