|
14 | 14 | Number of cores allocated to this target (default: 1). |
15 | 15 | * **memory (str):** |
16 | 16 | Memory allocated to this target (default: 4GB). |
| 17 | +* **walltime (str):** |
| 18 | + Wall-clock time limit, ``HH:MM:SS`` (default: ``01:00:00``). Emitted as |
| 19 | + ``#PBS -l walltime=...``. |
17 | 20 | * **queue (str):** |
18 | 21 | Queue to submit the target to (default: normal). |
| 22 | +* **account (str):** |
| 23 | + Accounting/group string for the job (default: unset). When set, emitted |
| 24 | + as ``#PBS -A <account>``; when empty the directive is omitted entirely. |
19 | 25 |
|
20 | 26 | """ |
21 | 27 |
|
|
32 | 38 |
|
33 | 39 | logger = logging.getLogger(__name__) |
34 | 40 |
|
35 | | -TARGET_DEFAULTS = {"queue": "normal", "memory": "4GB", "cores": 1} |
| 41 | +TARGET_DEFAULTS = { |
| 42 | + "queue": "normal", |
| 43 | + "memory": "4GB", |
| 44 | + "cores": 1, |
| 45 | + "walltime": "01:00:00", |
| 46 | + "account": "", |
| 47 | +} |
36 | 48 |
|
37 | 49 | PBS_HEADER = """#PBS -l mem={memory} |
38 | 50 | #PBS -l nodes=1:ppn={cores} |
| 51 | +#PBS -l walltime={walltime} |
39 | 52 | #PBS -q {queue} |
40 | 53 | #PBS -o {std_out} |
41 | 54 | #PBS -e {std_err} |
@@ -100,6 +113,11 @@ def compile_script(self, target): |
100 | 113 | for name, value in target_options.items(): |
101 | 114 | header = header.replace(f"{{{name}}}", str(value)) |
102 | 115 | header = header.replace("{job_name}", target.name) |
| 116 | + # Optional accounting directive. PBS rejects an empty argument to -A, |
| 117 | + # so the line is appended only when an account is actually configured. |
| 118 | + account = str(target_options.get("account", "")).strip() |
| 119 | + if account: |
| 120 | + header += f"\n#PBS -A {account}" |
103 | 121 | out = [] |
104 | 122 | out.append("#!/bin/bash") |
105 | 123 | out.append(header) |
|
0 commit comments