Skip to content

Commit 6993f2d

Browse files
cmeestersfgvieira
andauthored
fix: allowing for accounts containing whitespace (#86)
As [reported](snakemake/snakemake#2320), the plugin will not deal with account names containing whitespace. (accounts containing whitespace were not anticipated). This PR is an attempt to fix this. --------- Co-authored-by: Filipe G. Vieira <[email protected]>
1 parent 7b94aec commit 6993f2d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

snakemake_executor_plugin_slurm/__init__.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ def get_account_arg(self, job: JobExecutorInterface):
375375
# here, we check whether the given or guessed account is valid
376376
# if not, a WorkflowError is raised
377377
self.test_account(job.resources.slurm_account)
378-
return f" -A {job.resources.slurm_account}"
378+
return f" -A '{job.resources.slurm_account}'"
379379
else:
380380
if self._fallback_account_arg is None:
381381
self.logger.warning("No SLURM account given, trying to guess.")
@@ -442,7 +442,9 @@ def test_account(self, account):
442442
f"'{account}' with sacctmgr: {e.stderr}"
443443
)
444444

445-
accounts = accounts.split()
445+
# The set() has been introduced during review to eliminate
446+
# duplicates. They are not harmful, but disturbing to read.
447+
accounts = set(_.strip() for _ in accounts.split("\n") if _)
446448

447449
if account not in accounts:
448450
raise WorkflowError(

0 commit comments

Comments
 (0)