snakemake-executor-plugin-slurm 0.5.0__tar.gz → 0.5.2__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.5.0
3
+ Version: 0.5.2
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
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "snakemake-executor-plugin-slurm"
3
- version = "0.5.0"
3
+ version = "0.5.2"
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>",
@@ -123,14 +123,23 @@ class Executor(RemoteExecutor):
123
123
  "- submitting without. This might or might not work on your cluster."
124
124
  )
125
125
 
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)}"
126
+ if job.resources.get("nodes", False):
127
+ call += f" --nodes={job.resources.get('nodes', 1)}"
130
128
 
131
129
  # fixes #40 - set ntasks regarlless of mpi, because
132
130
  # SLURM v22.05 will require it for all jobs
133
131
  call += f" --ntasks={job.resources.get('tasks', 1)}"
132
+ # MPI job
133
+ if job.resources.get("mpi", False):
134
+ if not job.resources.get("tasks_per_node") and not job.resources.get(
135
+ "nodes"
136
+ ):
137
+ self.logger.warning(
138
+ "MPI job detected, but no 'tasks_per_node' or 'nodes' "
139
+ "specified. Assuming 'tasks_per_node=1'."
140
+ "Probably not what you want."
141
+ )
142
+
134
143
  call += f" --cpus-per-task={get_cpus_per_task(job)}"
135
144
 
136
145
  if job.resources.get("slurm_extra"):
@@ -214,7 +223,7 @@ class Executor(RemoteExecutor):
214
223
 
215
224
  # We use this sacct syntax for argument 'starttime' to keep it compatible
216
225
  # with slurm < 20.11
217
- sacct_starttime = f"{datetime.now() - timedelta(days=2):%Y-%m-%dT%H:00}"
226
+ sacct_starttime = f"{datetime.now() - timedelta(days = 2):%Y-%m-%dT%H:00}"
218
227
  # previously we had
219
228
  # f"--starttime now-2days --endtime now --name {self.run_uuid}"
220
229
  # in line 218 - once v20.11 is definitively not in use any more,
@@ -293,7 +302,9 @@ class Executor(RemoteExecutor):
293
302
  elif status in fail_stati:
294
303
  msg = (
295
304
  f"SLURM-job '{j.external_jobid}' failed, SLURM status is: "
296
- f"'{status}'"
305
+ # message ends with '. ', because it is proceeded
306
+ # with a new sentence
307
+ f"'{status}'. "
297
308
  )
298
309
  self.report_job_error(j, msg=msg, aux_logs=[j.aux["slurm_logfile"]])
299
310
  active_jobs_seen_by_sacct.remove(j.external_jobid)
@@ -373,7 +384,7 @@ class Executor(RemoteExecutor):
373
384
  # here, we check whether the given or guessed account is valid
374
385
  # if not, a WorkflowError is raised
375
386
  self.test_account(job.resources.slurm_account)
376
- return f" -A {job.resources.slurm_account}"
387
+ return f" -A '{job.resources.slurm_account}'"
377
388
  else:
378
389
  if self._fallback_account_arg is None:
379
390
  self.logger.warning("No SLURM account given, trying to guess.")
@@ -440,7 +451,9 @@ class Executor(RemoteExecutor):
440
451
  f"'{account}' with sacctmgr: {e.stderr}"
441
452
  )
442
453
 
443
- accounts = accounts.split()
454
+ # The set() has been introduced during review to eliminate
455
+ # duplicates. They are not harmful, but disturbing to read.
456
+ accounts = set(_.strip() for _ in accounts.split("\n") if _)
444
457
 
445
458
  if account not in accounts:
446
459
  raise WorkflowError(