Debian Codegraph @

tests/unit/job_runner_handlers/test_moab.py

raw
1 # THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE.
2 # Copyright (C) NIWA & British Crown (Met Office) & Contributors.
3 #
4 # This program is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation, either version 3 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17 import pytest
18
19 from cylc.flow.job_runner_handlers.moab import JOB_RUNNER_HANDLER
20
21
22 @pytest.mark.parametrize(
23 'job_conf,lines',
24 [
25 ( # basic
26 {
27 'directives': {},
28 'execution_time_limit': 180,
29 'job_file_path': 'cylc-run/chop/log/job/1/axe/01/job',
30 'workflow_name': 'chop',
31 'task_id': '1/axe',
32 },
33 [
34 '#PBS -N axe.1.chop',
35 '#PBS -o cylc-run/chop/log/job/1/axe/01/job.out',
36 '#PBS -e cylc-run/chop/log/job/1/axe/01/job.err',
37 '#PBS -l walltime=180',
38 ],
39 ),
40 ( # some useful directives
41 {
42 'directives': {
43 '-q': 'forever',
44 '-V': '',
45 '-l mem': '256gb',
46 },
47 'execution_time_limit': 180,
48 'job_file_path': 'cylc-run/chop/log/job/1/axe/01/job',
49 'workflow_name': 'chop',
50 'task_id': '1/axe',
51 },
52 [
53 '#PBS -N axe.1.chop',
54 '#PBS -o cylc-run/chop/log/job/1/axe/01/job.out',
55 '#PBS -e cylc-run/chop/log/job/1/axe/01/job.err',
56 '#PBS -l walltime=180',
57 '#PBS -q forever',
58 '#PBS -V',
59 '#PBS -l mem=256gb',
60 ],
61 ),
62 ],
63 )
64 def test_format_directives(job_conf: dict, lines: list):
65 assert JOB_RUNNER_HANDLER.format_directives(job_conf) == lines