snakemake-executor-plugin-slurm 0.4.2__tar.gz → 0.4.4__tar.gz

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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: snakemake-executor-plugin-slurm
3
- Version: 0.4.2
3
+ Version: 0.4.4
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
@@ -12,9 +12,9 @@ Classifier: License :: OSI Approved :: MIT License
12
12
  Classifier: Programming Language :: Python :: 3
13
13
  Classifier: Programming Language :: Python :: 3.11
14
14
  Classifier: Programming Language :: Python :: 3.12
15
- Requires-Dist: snakemake-executor-plugin-slurm-jobstep (>=0.1.10,<0.2.0)
15
+ Requires-Dist: snakemake-executor-plugin-slurm-jobstep (>=0.2.0,<0.3.0)
16
16
  Requires-Dist: snakemake-interface-common (>=1.13.0,<2.0.0)
17
- Requires-Dist: snakemake-interface-executor-plugins (>=9.0.0,<10.0.0)
17
+ Requires-Dist: snakemake-interface-executor-plugins (>=9.1.1,<10.0.0)
18
18
  Requires-Dist: throttler (>=1.2.2,<2.0.0)
19
19
  Project-URL: Documentation, https://snakemake.github.io/snakemake-plugin-catalog/plugins/executor/slurm.html
20
20
  Project-URL: Repository, https://github.com/snakemake/snakemake-executor-plugin-slurm
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "snakemake-executor-plugin-slurm"
3
- version = "0.4.2"
3
+ version = "0.4.4"
4
4
  description = "A Snakemake executor plugin for submitting jobs to a SLURM cluster."
5
5
  authors = [
6
6
  "Christian Meesters <meesters@uni-mainz.de>",
@@ -16,8 +16,8 @@ keywords = ["snakemake", "plugin", "executor", "cluster", "slurm"]
16
16
  [tool.poetry.dependencies]
17
17
  python = "^3.11"
18
18
  snakemake-interface-common = "^1.13.0"
19
- snakemake-interface-executor-plugins = "^9.0.0"
20
- snakemake-executor-plugin-slurm-jobstep = "^0.1.10"
19
+ snakemake-interface-executor-plugins = "^9.1.1"
20
+ snakemake-executor-plugin-slurm-jobstep = "^0.2.0"
21
21
  throttler = "^1.2.2"
22
22
 
23
23
  [tool.poetry.group.dev.dependencies]
@@ -18,6 +18,7 @@ from snakemake_interface_executor_plugins.jobs import (
18
18
  JobExecutorInterface,
19
19
  )
20
20
  from snakemake_interface_common.exceptions import WorkflowError
21
+ from snakemake_executor_plugin_slurm_jobstep import get_cpus_per_task
21
22
 
22
23
 
23
24
  # Required:
@@ -65,7 +66,7 @@ class Executor(RemoteExecutor):
65
66
  # with job_info being of type
66
67
  # snakemake_interface_executor_plugins.executors.base.SubmittedJobInfo.
67
68
 
68
- log_folder = f"group_{job.name}" if job.is_group() else f"rule_{job.name}"
69
+ group_or_rule = f"group_{job.name}" if job.is_group() else f"rule_{job.name}"
69
70
 
70
71
  try:
71
72
  wildcard_str = f"_{'_'.join(job.wildcards)}" if job.wildcards else ""
@@ -73,9 +74,17 @@ class Executor(RemoteExecutor):
73
74
  wildcard_str = ""
74
75
 
75
76
  slurm_logfile = os.path.abspath(
76
- f".snakemake/slurm_logs/{log_folder}/%j{wildcard_str}.log"
77
+ f".snakemake/slurm_logs/{group_or_rule}/{wildcard_str}/%j.log"
77
78
  )
78
- os.makedirs(os.path.dirname(slurm_logfile), exist_ok=True)
79
+ logdir = os.path.dirname(slurm_logfile)
80
+ # this behavior has been fixed in slurm 23.02, but there might be plenty of
81
+ # older versions around, hence we should rather be conservative here.
82
+ assert "%j" not in logdir, (
83
+ "bug: jobid placeholder in parent dir of logfile. This does not work as "
84
+ "we have to create that dir before submission in order to make sbatch "
85
+ "happy. Otherwise we get silent fails without logfiles being created."
86
+ )
87
+ os.makedirs(logdir, exist_ok=True)
79
88
 
80
89
  # generic part of a submission string:
81
90
  # we use a run_uuid as the job-name, to allow `--name`-based
@@ -118,18 +127,7 @@ class Executor(RemoteExecutor):
118
127
  # fixes #40 - set ntasks regarlless of mpi, because
119
128
  # SLURM v22.05 will require it for all jobs
120
129
  call += f" --ntasks={job.resources.get('tasks', 1)}"
121
-
122
- cpus_per_task = job.threads
123
- if job.resources.get("cpus_per_task"):
124
- if not isinstance(cpus_per_task, int):
125
- raise WorkflowError(
126
- f"cpus_per_task must be an integer, but is {cpus_per_task}"
127
- )
128
- cpus_per_task = job.resources.cpus_per_task
129
- # ensure that at least 1 cpu is requested
130
- # because 0 is not allowed by slurm
131
- cpus_per_task = max(1, cpus_per_task)
132
- call += f" --cpus-per-task={cpus_per_task}"
130
+ call += f" --cpus-per-task={get_cpus_per_task(job)}"
133
131
 
134
132
  if job.resources.get("slurm_extra"):
135
133
  call += f" {job.resources.slurm_extra}"