| 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.lsf 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 |
'#BSUB -J axe.1.chop', |
| 35 |
'#BSUB -o cylc-run/chop/log/job/1/axe/01/job.out', |
| 36 |
'#BSUB -e cylc-run/chop/log/job/1/axe/01/job.err', |
| 37 |
'#BSUB -W 3', |
| 38 |
], |
| 39 |
), |
| 40 |
( # some useful directives |
| 41 |
{ |
| 42 |
'directives': { |
| 43 |
'-q': 'forever', |
| 44 |
'-B': '', |
| 45 |
'-ar': '', |
| 46 |
}, |
| 47 |
'execution_time_limit': 200, |
| 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 |
'#BSUB -J axe.1.chop', |
| 54 |
'#BSUB -o cylc-run/chop/log/job/1/axe/01/job.out', |
| 55 |
'#BSUB -e cylc-run/chop/log/job/1/axe/01/job.err', |
| 56 |
'#BSUB -W 4', |
| 57 |
'#BSUB -q forever', |
| 58 |
'#BSUB -B', |
| 59 |
'#BSUB -ar', |
| 60 |
], |
| 61 |
), |
| 62 |
], |
| 63 |
) |
| 64 |
def test_format_directives(job_conf: dict, lines: list): |
| 65 |
assert JOB_RUNNER_HANDLER.format_directives(job_conf) == lines |
| 66 |
|
| 67 |
|
| 68 |
def test_get_submit_stdin(): |
| 69 |
outs = JOB_RUNNER_HANDLER.get_submit_stdin(__file__, None) |
| 70 |
assert outs[0].name == __file__ |
| 71 |
assert outs[1] is None |