Skip to content

Commit

Permalink
Fix func tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
hjoliver committed Jun 30, 2022
1 parent 986433a commit 86f5a6b
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/functional/cylc-config/09-platforms.t
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ set_test_number 5
cat > "global.cylc" <<__HEREDOC__
[platforms]
[[foo]]
job runner = slurm
hosts = of_melkor, of_valar
[[bar]]
job runner = slurm
hosts = of_orcs, of_gondor
[platform groups]
[[FOO]]
Expand Down Expand Up @@ -58,7 +60,7 @@ Platform Groups
__HEREDOC__

TEST_NAME="${TEST_NAME_BASE}-s"
head -n 8 > just_platforms < global.cylc
head -n 10 > just_platforms < global.cylc
run_ok "${TEST_NAME}" cylc config --platforms
cmp_ok "${TEST_NAME}.stdout" "just_platforms"

Expand Down
1 change: 1 addition & 0 deletions tests/functional/cylc-config/10-platform-expansion.t
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ cat > "global.cylc" <<__HEREDOC__
baz\d\d, qux\S\S \
]]
hosts = of_melkor, of_valar
job runner = slurm
__HEREDOC__

export CYLC_CONF_PATH="${PWD}"
Expand Down
6 changes: 6 additions & 0 deletions tests/functional/intelligent-host-selection/00-mixedhost.t
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export REQUIRE_PLATFORM='loc:remote fs:indep comms:tcp'
#-------------------------------------------------------------------------------
set_test_number 4

# Uses a fake background job runner to get around the single host restriction.

create_test_global_config "" "
[platforms]
[[goodhostplatform]]
Expand All @@ -32,6 +34,7 @@ create_test_global_config "" "
retrieve job logs = True
[[mixedhostplatform]]
job runner = my_background
hosts = unreachable_host, ${CYLC_TEST_HOST}
install target = ${CYLC_TEST_INSTALL_TARGET}
retrieve job logs = True
Expand All @@ -42,6 +45,9 @@ create_test_global_config "" "

install_workflow "${TEST_NAME_BASE}" "${TEST_NAME_BASE}"

# Install the fake background job runner.
cp -r "${TEST_SOURCE_DIR}/lib" "${WORKFLOW_RUN_DIR}"

run_ok "${TEST_NAME_BASE}-validate" cylc validate "${WORKFLOW_NAME}"

workflow_run_ok "${TEST_NAME_BASE}-run" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ set_test_number 3

install_workflow "${TEST_NAME_BASE}" "${TEST_NAME_BASE}"

# Install the fake background job runner.
cp -r "${TEST_SOURCE_DIR}/lib" "${WORKFLOW_RUN_DIR}"

create_test_global_config '' "
[scheduler]
[[main loop]]
Expand Down
7 changes: 7 additions & 0 deletions tests/functional/intelligent-host-selection/02-badhosts.t
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,12 @@ export REQUIRE_PLATFORM='loc:remote fs:indep comms:tcp'
#-------------------------------------------------------------------------------
set_test_number 6

# Uses a fake background job runner to get around the single host restriction.

create_test_global_config "" "
[platforms]
[[badhostplatform]]
job runner = my_background
hosts = e9755ca30f5, 3c0b4799402
install target = ${CYLC_TEST_INSTALL_TARGET}
[[[selection]]]
Expand All @@ -39,6 +42,7 @@ create_test_global_config "" "
retrieve job logs = True
[[mixedhostplatform]]
job runner = my_background
hosts = unreachable_host, ${CYLC_TEST_HOST}
install target = ${CYLC_TEST_INSTALL_TARGET}
retrieve job logs = True
Expand All @@ -51,6 +55,9 @@ create_test_global_config "" "

install_workflow "${TEST_NAME_BASE}" "${TEST_NAME_BASE}"

# Install the fake background job runner.
cp -r "${TEST_SOURCE_DIR}/lib" "${WORKFLOW_RUN_DIR}"

run_ok "${TEST_NAME_BASE}-validate" cylc validate "${WORKFLOW_NAME}"

workflow_run_ok "${TEST_NAME_BASE}-run" \
Expand Down
6 changes: 6 additions & 0 deletions tests/functional/intelligent-host-selection/03-polling.t
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ export REQUIRE_PLATFORM='loc:remote fs:indep'
#-------------------------------------------------------------------------------
set_test_number 4

# Uses a fake background job runner to get around the single host restriction.

create_test_global_config "" "
[scheduler]
[[main loop]]
Expand All @@ -46,6 +48,7 @@ create_test_global_config "" "
submission polling intervals = PT0S, 5*PT2S
[[mixedhostplatform]]
job runner = my_background
hosts = unreachable_host, ${CYLC_TEST_HOST}
install target = ${CYLC_TEST_INSTALL_TARGET}
retrieve job logs = True
Expand All @@ -58,6 +61,9 @@ create_test_global_config "" "
#-------------------------------------------------------------------------------
install_workflow "${TEST_NAME_BASE}" "${TEST_NAME_BASE}"

# Install the fake background job runner.
cp -r "${TEST_SOURCE_DIR}/lib" "${WORKFLOW_RUN_DIR}"

run_ok "${TEST_NAME_BASE}-validate" cylc validate "${WORKFLOW_NAME}"

workflow_run_ok "${TEST_NAME_BASE}-run" \
Expand Down
6 changes: 6 additions & 0 deletions tests/functional/intelligent-host-selection/04-kill.t
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export REQUIRE_PLATFORM='loc:remote fs:indep comms:tcp'
#-------------------------------------------------------------------------------
set_test_number 4

# Uses a fake background job runner to get around the single host restriction.

create_test_global_config "" "
[scheduler]
[[main loop]]
Expand All @@ -36,6 +38,7 @@ create_test_global_config "" "
install target = ${CYLC_TEST_INSTALL_TARGET}
[[mixedhostplatform]]
job runner = my_background
hosts = unreachable_host, ${CYLC_TEST_HOST}
install target = ${CYLC_TEST_INSTALL_TARGET}
[[[selection]]]
Expand All @@ -45,6 +48,9 @@ create_test_global_config "" "

install_workflow "${TEST_NAME_BASE}" "${TEST_NAME_BASE}"

# Install the fake background job runner.
cp -r "${TEST_SOURCE_DIR}/lib" "${WORKFLOW_RUN_DIR}"

run_ok "${TEST_NAME_BASE}-validate" cylc validate "${WORKFLOW_NAME}"

workflow_run_ok "${TEST_NAME_BASE}-run" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,18 @@ export REQUIRE_PLATFORM='loc:remote fs:indep comms:tcp'
#-------------------------------------------------------------------------------
set_test_number 11

# Uses a fake background job runner to get around the single host restriction.

create_test_global_config "" "
[platforms]
[[${CYLC_TEST_PLATFORM}]]
# mixed host platform
job runner = my_background
hosts = unreachable_host, ${CYLC_TEST_HOST}
[[[selection]]]
method = 'definition order'
[[badhostplatform]]
job runner = my_background
hosts = bad_host1, bad_host2
[[[selection]]]
method = 'definition order'
Expand All @@ -54,6 +58,9 @@ create_test_global_config "" "

install_workflow "${TEST_NAME_BASE}" "${TEST_NAME_BASE}"

# Install the fake background job runner.
cp -r "${TEST_SOURCE_DIR}/lib" "${WORKFLOW_RUN_DIR}"

run_ok "${TEST_NAME_BASE}-validate" cylc validate "${WORKFLOW_NAME}"

workflow_run_ok "${TEST_NAME_BASE}-run" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,16 @@
. "$(dirname "$0")/test_header"
set_test_number 12
#-------------------------------------------------------------------------------

# Uses a fake background job runner to get around the single host restriction.

create_test_global_config "" "
[platforms]
[[badhostplatform1]]
job runner = my_background
hosts = bad_host1, bad_host2
[[badhostplatform2]]
job runner = my_background
hosts = bad_host3, bad_host4
[platform groups]
Expand All @@ -36,6 +41,9 @@ create_test_global_config "" "

install_workflow "${TEST_NAME_BASE}" "${TEST_NAME_BASE}"

# Install the fake background job runner.
cp -r "${TEST_SOURCE_DIR}/lib" "${WORKFLOW_RUN_DIR}"

run_ok "${TEST_NAME_BASE}-validate" cylc validate "${WORKFLOW_NAME}"

workflow_run_fail "${TEST_NAME_BASE}-run" \
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env python3

# THIS FILE IS PART OF THE CYLC WORKFLOW ENGINE.
# Copyright (C) NIWA & British Crown (Met Office) & Contributors.
#
# 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/>.

from cylc.flow.job_runner_handlers.background import BgCommandHandler


class MyBgCommandHandler(BgCommandHandler):
pass


JOB_RUNNER_HANDLER = MyBgCommandHandler()

0 comments on commit 86f5a6b

Please sign in to comment.