| 1 |
#!/usr/bin/env bash |
| 2 |
# THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE. |
| 3 |
# Copyright (C) NIWA & British Crown (Met Office) & Contributors. |
| 4 |
# |
| 5 |
# This program is free software: you can redistribute it and/or modify |
| 6 |
# it under the terms of the GNU General Public License as published by |
| 7 |
# the Free Software Foundation, either version 3 of the License, or |
| 8 |
# (at your option) any later version. |
| 9 |
# |
| 10 |
# This program is distributed in the hope that it will be useful, |
| 11 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
# GNU General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU General Public License |
| 16 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 |
#------------------------------------------------------------------------------- |
| 18 |
# Test that job submission kill on timeout results in a failed job submission. |
| 19 |
export REQUIRE_PLATFORM='runner:at comms:tcp' |
| 20 |
. "$(dirname "$0")/test_header" |
| 21 |
set_test_number 4 |
| 22 |
|
| 23 |
create_test_global_config "" " |
| 24 |
[scheduler] |
| 25 |
process pool timeout = PT10S |
| 26 |
[platforms] |
| 27 |
[[$CYLC_TEST_PLATFORM]] |
| 28 |
job runner command template = sleep 30 |
| 29 |
" |
| 30 |
|
| 31 |
install_workflow "${TEST_NAME_BASE}" "${TEST_NAME_BASE}" |
| 32 |
|
| 33 |
run_ok "${TEST_NAME_BASE}-validate" cylc validate "${WORKFLOW_NAME}" |
| 34 |
|
| 35 |
workflow_run_ok "${TEST_NAME_BASE}-workflow-run" \ |
| 36 |
cylc play --debug --no-detach "${WORKFLOW_NAME}" |
| 37 |
|
| 38 |
# egrep -m <num> is stop matching after <num> matches |
| 39 |
# -A <num> is number of lines of context after match |
| 40 |
cylc cat-log "${WORKFLOW_NAME}" \ |
| 41 |
| grep -E -m 1 -A 2 "ERROR - \[jobs-submit cmd\]" \ |
| 42 |
| sed -e 's/^.* \(ERROR\)/\1/' > log |
| 43 |
WORKFLOW_LOG_DIR=$(cylc cat-log -m p "${WORKFLOW_NAME}" | sed 's/01-start-01\.//') |
| 44 |
JOB_LOG_DIR="${WORKFLOW_LOG_DIR%scheduler/log}" |
| 45 |
JOB_LOG_DIR="${JOB_LOG_DIR/$HOME/\$HOME}" |
| 46 |
|
| 47 |
DEFAULT_PATHS='--path=/bin --path=/usr/bin --path=/usr/local/bin --path=/sbin --path=/usr/sbin --path=/usr/local/sbin' |
| 48 |
cmp_ok log <<__END__ |
| 49 |
ERROR - [jobs-submit cmd] cylc jobs-submit --debug ${DEFAULT_PATHS} -- '${JOB_LOG_DIR}job' 1/foo/01 |
| 50 |
[jobs-submit ret_code] -9 |
| 51 |
[jobs-submit err] killed on timeout (PT10S) |
| 52 |
__END__ |
| 53 |
|
| 54 |
cylc workflow-state --old-format "${WORKFLOW_NAME}" > workflow-state.log |
| 55 |
|
| 56 |
# make sure foo submit failed and the stopper ran |
| 57 |
contains_ok workflow-state.log << __END__ |
| 58 |
stopper, 1, succeeded |
| 59 |
foo, 1, submit-failed |
| 60 |
__END__ |
| 61 |
|
| 62 |
purge |