From 408e788bd8a08bfd15c6a71c33623d07c90b58d4 Mon Sep 17 00:00:00 2001 From: nicorap <78540495+nicorap@users.noreply.github.com> Date: Wed, 27 May 2026 17:36:05 +0200 Subject: [PATCH] pbs: honour walltime and account target options PBS backend silently dropped walltime and account from TARGET_DEFAULTS, making long jobs hit cluster default walltimes and ignoring accounting on sites that require -A. - walltime: added to TARGET_DEFAULTS (default 01:00:00) and emitted as #PBS -l walltime={walltime}. - account: added to TARGET_DEFAULTS (default "") with conditional emission - the #PBS -A line is omitted when empty so sites that don't use accounting are unaffected. --- src/gwf/backends/pbs.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/gwf/backends/pbs.py b/src/gwf/backends/pbs.py index 67f06ce9..b12f05cf 100644 --- a/src/gwf/backends/pbs.py +++ b/src/gwf/backends/pbs.py @@ -14,8 +14,14 @@ Number of cores allocated to this target (default: 1). * **memory (str):** Memory allocated to this target (default: 4GB). +* **walltime (str):** + Wall-clock time limit, ``HH:MM:SS`` (default: ``01:00:00``). Emitted as + ``#PBS -l walltime=...``. * **queue (str):** Queue to submit the target to (default: normal). +* **account (str):** + Accounting/group string for the job (default: unset). When set, emitted + as ``#PBS -A ``; when empty the directive is omitted entirely. """ @@ -32,10 +38,17 @@ logger = logging.getLogger(__name__) -TARGET_DEFAULTS = {"queue": "normal", "memory": "4GB", "cores": 1} +TARGET_DEFAULTS = { + "queue": "normal", + "memory": "4GB", + "cores": 1, + "walltime": "01:00:00", + "account": "", +} PBS_HEADER = """#PBS -l mem={memory} #PBS -l nodes=1:ppn={cores} +#PBS -l walltime={walltime} #PBS -q {queue} #PBS -o {std_out} #PBS -e {std_err} @@ -100,6 +113,11 @@ def compile_script(self, target): for name, value in target_options.items(): header = header.replace(f"{{{name}}}", str(value)) header = header.replace("{job_name}", target.name) + # Optional accounting directive. PBS rejects an empty argument to -A, + # so the line is appended only when an account is actually configured. + account = str(target_options.get("account", "")).strip() + if account: + header += f"\n#PBS -A {account}" out = [] out.append("#!/bin/bash") out.append(header)