From df666da137490f396c1a2bf1d24af77cfc65c002 Mon Sep 17 00:00:00 2001 From: Susana Posada-Cespedes Date: Wed, 4 Aug 2021 11:38:44 +0200 Subject: [PATCH] Modify behaviour to request all rules in a group to be set as preemptible instances --- docs/snakefiles/rules.rst | 2 +- snakemake/executors/google_lifesciences.py | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/snakefiles/rules.rst b/docs/snakefiles/rules.rst index 5b0e5589d..b22e55ea0 100644 --- a/docs/snakefiles/rules.rst +++ b/docs/snakefiles/rules.rst @@ -1341,7 +1341,7 @@ However, if we would add ``group: "mygroup"`` to rule ``c``, all jobs would end Alternatively, groups can be defined via the command line interface. This enables to almost arbitrarily partition the DAG, e.g. in order to safe network traffic, see :ref:`here `. -For execution on the cloud using Google Life Science API and preemptible instances, note than if any of the rules in a group is included in the subset of rules to be executed using preembtible instances (with command line option ``--preemptible-rules``), the group will be also scheduled to be executed on a preemptible instance. +For execution on the cloud using Google Life Science API and preemptible instances, we expect all rules in the group to be homogenously set as preemptible instances (e.g., with command-line option ``--preemptible-rules``), such that a preemptible VM is requested for the execution of the group job. Piped output ------------ diff --git a/snakemake/executors/google_lifesciences.py b/snakemake/executors/google_lifesciences.py index 4fd3f5062..aeb109687 100644 --- a/snakemake/executors/google_lifesciences.py +++ b/snakemake/executors/google_lifesciences.py @@ -512,7 +512,13 @@ def _generate_job_resources(self, job): ) if job.is_group(): - preemptible = any(rule in self.preemptible_rules for rule in job.rules) + preemptible = all(rule in self.preemptible_rules for rule in job.rules) + if not preemtible and any( + rule in self.preemptible_rules for rule in job.rules + ): + raise WorkflowError( + "All grouped rules should be homogenously set as preemptible rules" + ) else: preemptible = job.rule.name in self.preemptible_rules # We add the size for the image itself (10 GB) to bootDiskSizeGb