snakemake-executor-plugin-slurm 0.5.1__py3-none-any.whl → 0.6.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of snakemake-executor-plugin-slurm might be problematic. Click here for more details.

@@ -6,6 +6,7 @@ __license__ = "MIT"
6
6
  import csv
7
7
  from io import StringIO
8
8
  import os
9
+ import re
9
10
  import subprocess
10
11
  import time
11
12
  from datetime import datetime, timedelta
@@ -123,17 +124,27 @@ class Executor(RemoteExecutor):
123
124
  "- submitting without. This might or might not work on your cluster."
124
125
  )
125
126
 
126
- # MPI job
127
- if job.resources.get("mpi", False):
128
- if job.resources.get("nodes", False):
129
- call += f" --nodes={job.resources.get('nodes', 1)}"
127
+ if job.resources.get("nodes", False):
128
+ call += f" --nodes={job.resources.get('nodes', 1)}"
130
129
 
131
130
  # fixes #40 - set ntasks regarlless of mpi, because
132
131
  # SLURM v22.05 will require it for all jobs
133
132
  call += f" --ntasks={job.resources.get('tasks', 1)}"
133
+ # MPI job
134
+ if job.resources.get("mpi", False):
135
+ if not job.resources.get("tasks_per_node") and not job.resources.get(
136
+ "nodes"
137
+ ):
138
+ self.logger.warning(
139
+ "MPI job detected, but no 'tasks_per_node' or 'nodes' "
140
+ "specified. Assuming 'tasks_per_node=1'."
141
+ "Probably not what you want."
142
+ )
143
+
134
144
  call += f" --cpus-per-task={get_cpus_per_task(job)}"
135
145
 
136
146
  if job.resources.get("slurm_extra"):
147
+ self.check_slurm_extra(job)
137
148
  call += f" {job.resources.slurm_extra}"
138
149
 
139
150
  exec_job = self.format_job_exec(job)
@@ -479,3 +490,15 @@ class Executor(RemoteExecutor):
479
490
  "'slurm_partition=<your default partition>'."
480
491
  )
481
492
  return ""
493
+
494
+ def check_slurm_extra(self, job):
495
+ jobname = re.compile(r"--job-name[=?|\s+]|-J\s?")
496
+ if re.search(jobname, job.resources.slurm_extra):
497
+ raise WorkflowError(
498
+ "The '--job-name' option is not allowed in the 'slurm_extra' "
499
+ "parameter. The job name is set by snakemake and must not be "
500
+ "overwritten. It is internally used to check the stati of all "
501
+ "submitted jobs by this workflow."
502
+ "Please consult the documentation if you are unsure how to "
503
+ "query the status of your jobs."
504
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: snakemake-executor-plugin-slurm
3
- Version: 0.5.1
3
+ Version: 0.6.0
4
4
  Summary: A Snakemake executor plugin for submitting jobs to a SLURM cluster.
5
5
  Home-page: https://github.com/snakemake/snakemake-executor-plugin-slurm
6
6
  License: MIT
@@ -0,0 +1,5 @@
1
+ snakemake_executor_plugin_slurm/__init__.py,sha256=tYTHco7vGZ6OtU-Cxfdy9PUJX8z-Svs7exL8x8bYBLk,21575
2
+ snakemake_executor_plugin_slurm-0.6.0.dist-info/LICENSE,sha256=YVc4xTLWMqGfFL36120k7rzXtsT6e4RkJsh68VVn12s,1076
3
+ snakemake_executor_plugin_slurm-0.6.0.dist-info/METADATA,sha256=R-SvE45vFNUtJVfJjF_qOQjoSojYkKGxGsIe5kaZz-8,1380
4
+ snakemake_executor_plugin_slurm-0.6.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
5
+ snakemake_executor_plugin_slurm-0.6.0.dist-info/RECORD,,
@@ -1,5 +0,0 @@
1
- snakemake_executor_plugin_slurm/__init__.py,sha256=Ws-zsZP80iCC6q78M0mHea0fQhD0FtktpmfbxkC-4AQ,20551
2
- snakemake_executor_plugin_slurm-0.5.1.dist-info/LICENSE,sha256=YVc4xTLWMqGfFL36120k7rzXtsT6e4RkJsh68VVn12s,1076
3
- snakemake_executor_plugin_slurm-0.5.1.dist-info/METADATA,sha256=lkfe53yQkU9ZFupesBM4k8LG-lnx-U7pK5X8dl0E5XQ,1380
4
- snakemake_executor_plugin_slurm-0.5.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
5
- snakemake_executor_plugin_slurm-0.5.1.dist-info/RECORD,,