Skip to content

Commit

Permalink
Merge pull request #1583 from matthewrmshin/fix-ssh-messaging-pyro-fa…
Browse files Browse the repository at this point in the history
…ll-through

Fix SSH messaging fall through to Pyro
  • Loading branch information
hjoliver committed Aug 26, 2015
2 parents e360ce9 + 75376f6 commit ef097b0
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/cylc/task_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,11 +249,13 @@ def _send_by_ssh(self):
# The path to cylc/bin on the remote end may be required:
path = os.path.join(self.env_map['CYLC_DIR_ON_SUITE_HOST'], 'bin')

if remrun().execute(env=env, path=[path]):
# Return here if remote re-invocation occurred,
# otherwise drop through to local Pyro messaging.
# Note: do not sys.exit(0) here as the commands do, it
# will cause messaging failures on the remote host.
# Return here if remote re-invocation occurred,
# otherwise drop through to local Pyro messaging.
# Note: do not sys.exit(0) here as the commands do, it
# will cause messaging failures on the remote host.
try:
return remrun().execute(env=env, path=[path])
except SystemExit:
return

def _update_job_status_file(self, messages):
Expand Down
53 changes: 53 additions & 0 deletions tests/cylc-message/00-ssh.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/bash
# THIS FILE IS PART OF THE CYLC SUITE ENGINE.
# Copyright (C) 2008-2015 NIWA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#-------------------------------------------------------------------------------
# Test "cylc message" in SSH mode, test needs to have compatible version
# installed on the remote host.
. "$(dirname "$0")/test_header"
#-------------------------------------------------------------------------------
CYLC_TEST_HOST="$(cylc get-global-config -i '[test battery]remote host')"
if [[ -z "${CYLC_TEST_HOST}" ]]; then
skip_all '[test battery]remote host: not defined'
fi
set_test_number 3

mkdir 'conf'
cat >>'conf/global.rc' <<__GLOBAL_RC__
[hosts]
[[${CYLC_TEST_HOST}]]
task communication method = ssh
__GLOBAL_RC__
export CYLC_CONF_PATH="${PWD}/conf"

install_suite "${TEST_NAME_BASE}" "${TEST_NAME_BASE}"
# Note: Don't install passphrase on remote host. Message should only return via
# SSH.

run_ok "${TEST_NAME_BASE}-validate" \
cylc validate "${SUITE_NAME}" -s "CYLC_TEST_HOST=${CYLC_TEST_HOST}"
suite_run_ok "${TEST_NAME_BASE}-run" \
cylc run --debug --reference-test "${SUITE_NAME}" \
-s "CYLC_TEST_HOST=${CYLC_TEST_HOST}"

run_fail "${TEST_NAME_BASE}-grep-DENIED-suite-log" \
grep -q "\\[client-connect\\] DENIED .*@${CYLC_TEST_HOST}:cylc-message" \
"$(cylc get-global-config --print-run-dir)/${SUITE_NAME}/log/suite/log"

ssh -oBatchMode=yes -oConnectTimeout=5 "${CYLC_TEST_HOST}" \
"rm -rf '.cylc/${SUITE_NAME}' 'cylc-run/${SUITE_NAME}'"
purge_suite "${SUITE_NAME}"
exit
5 changes: 5 additions & 0 deletions tests/cylc-message/00-ssh/reference.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
2015-08-26T10:10:10Z INFO - Run mode: live
2015-08-26T10:10:10Z INFO - Initial point: 1
2015-08-26T10:10:10Z INFO - Final point: 1
2015-08-26T10:10:10Z INFO - Cold Start 1
2015-08-26T10:10:10Z INFO - [t0.1] -triggered off []
15 changes: 15 additions & 0 deletions tests/cylc-message/00-ssh/suite.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!jinja2
[cylc]
UTC mode = True # Ignore DST
[[reference test]]
live mode suite timeout = PT1M

[scheduling]
[[dependencies]]
graph=t0

[runtime]
[[t0]]
script = true
[[[remote]]]
host = {{CYLC_TEST_HOST}}
1 change: 1 addition & 0 deletions tests/cylc-message/test_header

0 comments on commit ef097b0

Please sign in to comment.