From d3ec399ca2679b56f6ed8795d9631fea4f221102 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20K=C3=B6ster?= Date: Thu, 29 Jun 2023 18:03:42 +0200 Subject: [PATCH] fix: do not allow setting benchmark and between-workflow caching for the same rule. The reason is that when the result is taken from cache, there is no way to fill the benchmark file with any reasonable values. --- snakemake/workflow.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/snakemake/workflow.py b/snakemake/workflow.py index 14cab8c1d..ee19f7f69 100644 --- a/snakemake/workflow.py +++ b/snakemake/workflow.py @@ -1620,6 +1620,15 @@ def decorate(ruleinfo): "Invalid value for cache directive. Use True or 'omit-software'.", rule=rule, ) + if ruleinfo.benchmark and self.get_cache_mode(rule): + raise WorkflowError( + "Rules with a benchmark directive may not be marked as eligible " + "for between-workflow caching at the same time. The reason is that " + "when the result is taken from cache, there is no way to fill the benchmark file with " + "any reasonable values. Either remove the benchmark directive or disable " + "between-workflow caching for this rule.", + rule=rule, + ) if ruleinfo.default_target is True: self.default_target = rule.name