snakemake-executor-plugin-slurm 0.6.0__tar.gz → 0.7.0__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.6.0
3
+ Version: 0.7.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
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "snakemake-executor-plugin-slurm"
3
- version = "0.6.0"
3
+ version = "0.7.0"
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>",
@@ -50,11 +50,24 @@ common_settings = CommonSettings(
50
50
  # Implementation of your executor
51
51
  class Executor(RemoteExecutor):
52
52
  def __post_init__(self):
53
+ # run check whether we are running in a SLURM job context
54
+ self.warn_on_jobcontext()
53
55
  self.run_uuid = str(uuid.uuid4())
54
56
  self.logger.info(f"SLURM run ID: {self.run_uuid}")
55
57
  self._fallback_account_arg = None
56
58
  self._fallback_partition = None
57
59
 
60
+ def warn_on_jobcontext(self, done=None):
61
+ if not done:
62
+ if "SLURM_JOB_ID" in os.environ:
63
+ self.logger.warning(
64
+ "Running Snakemake in a SLURM within a job may lead"
65
+ " to unexpected behavior. Please run Snakemake directly"
66
+ " on the head node."
67
+ )
68
+ time.sleep(5)
69
+ done = True
70
+
58
71
  def additional_general_args(self):
59
72
  return "--executor slurm-jobstep --jobs 1"
60
73
 
@@ -393,6 +406,7 @@ class Executor(RemoteExecutor):
393
406
  account = self.get_account()
394
407
  if account:
395
408
  self.logger.warning(f"Guessed SLURM account: {account}")
409
+ self.test_account(f"{account}")
396
410
  self._fallback_account_arg = f" -A {account}"
397
411
  else:
398
412
  self.logger.warning(
@@ -430,7 +444,7 @@ class Executor(RemoteExecutor):
430
444
  sacct_out = subprocess.check_output(
431
445
  cmd, shell=True, text=True, stderr=subprocess.PIPE
432
446
  )
433
- return sacct_out.strip()
447
+ return sacct_out.replace("(null)", "").strip()
434
448
  except subprocess.CalledProcessError as e:
435
449
  self.logger.warning(
436
450
  f"No account was given, not able to get a SLURM account via sacct: "