diff --git a/snakemake_executor_plugin_slurm/__init__.py b/snakemake_executor_plugin_slurm/__init__.py index 583b077..27c9367 100644 --- a/snakemake_executor_plugin_slurm/__init__.py +++ b/snakemake_executor_plugin_slurm/__init__.py @@ -343,6 +343,11 @@ def run_job(self, job: JobExecutorInterface): exec_job = self.format_job_exec(job) + # Prevent forwarding Snakemake retry attempts into the remote + # jobstep. Convert any "--attempt " or "--attempt=" to + # a single attempt in the remote context. + exec_job = re.sub(r"--attempt(?:[=\s]+)\d+", "--attempt 1", exec_job) + # and finally the job to execute with all the snakemake parameters call += f' --wrap="{exec_job}"'