snakemake-executor-plugin-slurm 1.0.0__tar.gz → 1.0.1__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.3
2
2
  Name: snakemake-executor-plugin-slurm
3
- Version: 1.0.0
3
+ Version: 1.0.1
4
4
  Summary: A Snakemake executor plugin for submitting jobs to a SLURM cluster.
5
5
  License: MIT
6
6
  Keywords: snakemake,plugin,executor,cluster,slurm
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "snakemake-executor-plugin-slurm"
3
- version = "1.0.0"
3
+ version = "1.0.1"
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>",
@@ -85,6 +85,15 @@ class ExecutorSettings(ExecutorSettingsBase):
85
85
  "required": False,
86
86
  },
87
87
  )
88
+ no_account: bool = field(
89
+ default=False,
90
+ metadata={
91
+ "help": "Do not use any account for submission. "
92
+ "This flag has no effect, if not set.",
93
+ "env_var": False,
94
+ "required": False,
95
+ },
96
+ )
88
97
 
89
98
 
90
99
  # Required:
@@ -213,7 +222,9 @@ class Executor(RemoteExecutor):
213
222
  f"--comment '{comment_str}'"
214
223
  )
215
224
 
216
- call += self.get_account_arg(job)
225
+ if not self.workflow.executor_settings.no_account:
226
+ call += self.get_account_arg(job)
227
+
217
228
  call += self.get_partition_arg(job)
218
229
 
219
230
  if self.workflow.executor_settings.requeue:
@@ -634,35 +645,45 @@ We leave it to SLURM to resume your job(s)"""
634
645
  """
635
646
  tests whether the given account is registered, raises an error, if not
636
647
  """
637
- cmd = f'sacctmgr -n -s list user "{os.environ["USER"]}" format=account%256'
648
+ cmd = "sshare -U --format Account --noheader"
638
649
  try:
639
650
  accounts = subprocess.check_output(
640
651
  cmd, shell=True, text=True, stderr=subprocess.PIPE
641
652
  )
642
653
  except subprocess.CalledProcessError as e:
643
- sacctmgr_report = (
644
- "Unable to test the validity of the given or guessed "
645
- f"SLURM account '{account}' with sacctmgr: {e.stderr}."
654
+ sshare_report = (
655
+ "Unable to test the validity of the given or guessed"
656
+ f" SLURM account '{account}' with sshare: {e.stderr}."
646
657
  )
658
+ accounts = ""
659
+
660
+ if not accounts.strip():
661
+ cmd = f'sacctmgr -n -s list user "{os.environ["USER"]}" format=account%256'
647
662
  try:
648
- cmd = "sshare -U --format Account --noheader"
649
663
  accounts = subprocess.check_output(
650
664
  cmd, shell=True, text=True, stderr=subprocess.PIPE
651
665
  )
652
- except subprocess.CalledProcessError as e2:
653
- sshare_report = (
654
- "Unable to test the validity of the given or guessed"
655
- f" SLURM account '{account}' with sshare: {e2.stderr}."
666
+ except subprocess.CalledProcessError as e:
667
+ sacctmgr_report = (
668
+ "Unable to test the validity of the given or guessed "
669
+ f"SLURM account '{account}' with sacctmgr: {e.stderr}."
656
670
  )
657
671
  raise WorkflowError(
658
- f"The 'sacctmgr' reported: '{sacctmgr_report}' "
659
- f"and likewise 'sshare' reported: '{sshare_report}'."
672
+ f"The 'sshare' reported: '{sshare_report}' "
673
+ f"and likewise 'sacctmgr' reported: '{sacctmgr_report}'."
660
674
  )
661
675
 
662
676
  # The set() has been introduced during review to eliminate
663
677
  # duplicates. They are not harmful, but disturbing to read.
664
678
  accounts = set(_.strip() for _ in accounts.split("\n") if _)
665
679
 
680
+ if not accounts:
681
+ self.logger.warning(
682
+ f"Both 'sshare' and 'sacctmgr' returned empty results for account "
683
+ f"'{account}'. Proceeding without account validation."
684
+ )
685
+ return ""
686
+
666
687
  if account not in accounts:
667
688
  raise WorkflowError(
668
689
  f"The given account {account} appears to be invalid. Available "