From 2e08240ecb78e4c6a0b56547b902c92bb7550b03 Mon Sep 17 00:00:00 2001 From: Christian Meesters Date: Tue, 27 Aug 2024 12:27:39 +0200 Subject: [PATCH 1/2] feat: added flag to cancel all jobs upon a failure of one --- snakemake_executor_plugin_slurm/__init__.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/snakemake_executor_plugin_slurm/__init__.py b/snakemake_executor_plugin_slurm/__init__.py index a39936b1..656e7e66 100644 --- a/snakemake_executor_plugin_slurm/__init__.py +++ b/snakemake_executor_plugin_slurm/__init__.py @@ -40,6 +40,18 @@ class ExecutorSettings(ExecutorSettingsBase): "required": False, }, ) + cancel_workflow_upon_failure: bool = field( + default=False, + metadata={ + "help": """ + Negates the `--keep-going` flag in Snakemake. + If set to True, the entire workflow will be canceled + upon recognition of a failed job. + """, + "env_var": False, + "required": False, + }, + ) # Required: @@ -373,6 +385,8 @@ async def check_active_jobs( ) self.report_job_error(j, msg=msg, aux_logs=[j.aux["slurm_logfile"]]) active_jobs_seen_by_sacct.remove(j.external_jobid) + if self.settings.cancel_workflow_upon_failure: + self.cancel_jobs(active_jobs) else: # still running? yield j From db746012e7f047a1e4ce0e1e39300ba7006cc185 Mon Sep 17 00:00:00 2001 From: Christian Meesters Date: Tue, 27 Aug 2024 13:24:07 +0200 Subject: [PATCH 2/2] docs: complemented docs to accomodate for the previous commit --- docs/further.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/further.md b/docs/further.md index 96fea95a..acb585b5 100644 --- a/docs/further.md +++ b/docs/further.md @@ -31,8 +31,6 @@ Usually, it is advisable to persist such settings via a [configuration profile](https://snakemake.readthedocs.io/en/latest/executing/cli.html#profiles), which can be provided system-wide, per user, and in addition per workflow. -The executor waits per default 40 seconds for its first check of the job status. Using `--slurm-init-seconds-before-status-checks=