Skip to content

Commit

Permalink
platform: fix upgrader with inheritance
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-sanders committed Mar 25, 2021
1 parent 1615372 commit c45aa27
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 16 deletions.
8 changes: 4 additions & 4 deletions cylc/flow/cfgspec/suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -1522,12 +1522,12 @@ def upg(cfg, descr):
):
if job_setting in cfg['runtime'][task]:
LOG.warning(
"* (8.0.0) '[runtime][{task}]{job_setting}' - this "
"setting is deprecated; use"
"'global.cylc[platforms][<platform name>]{job_setting}' "
f"* (8.0.0) '[runtime][{task}]{job_setting}' - this "
"setting is deprecated; use "
f"'global.cylc[platforms][<platform name>]{job_setting}' "
"instead. "
"Currently, this item will override the corresponding "
"item in global.cylc,"
"item in global.cylc, "
"but support for this will be removed in Cylc 9."
)

Expand Down
6 changes: 5 additions & 1 deletion cylc/flow/task_job_mgr.py
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,11 @@ def _prep_submit_task_job(self, suite, itask, check_syntax=True):
if host_n is None and platform_n is None:
itask.set_summary_message(self.REMOTE_SELECT_MSG)
return
elif host_n is None and rtconfig['platform'] != platform_n:
elif (
host_n is None
and rtconfig['platform']
and rtconfig['platform'] != platform_n
):
LOG.debug(
f"for task {itask.identity}: platform = "
f"{rtconfig['platform']} evaluated as {platform_n}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@ WARNING - * (8.0.0) [runtime][foo, cat, dog][job][execution time limit] -> [run
WARNING - * (8.0.0) [runtime][foo, cat, dog][job][submission polling intervals] -> [runtime][foo, cat, dog][submission polling intervals] - value unchanged
WARNING - * (8.0.0) [runtime][foo, cat, dog][job][submission retry delays] -> [runtime][foo, cat, dog][submission retry delays] - value unchanged
WARNING - * (8.0.0) [cylc] -> [scheduler] - value unchanged
WARNING - * (8.0.0) '[runtime][{task}]{job_setting}' - this setting is deprecated; use'global.cylc[platforms][<platform name>]{job_setting}' instead. Currently, this item will override the corresponding item in global.cylc,but support for this will be removed in Cylc 9.
WARNING - * (8.0.0) '[runtime][{task}]{job_setting}' - this setting is deprecated; use'global.cylc[platforms][<platform name>]{job_setting}' instead. Currently, this item will override the corresponding item in global.cylc,but support for this will be removed in Cylc 9.
WARNING - * (8.0.0) '[runtime][{task}]{job_setting}' - this setting is deprecated; use'global.cylc[platforms][<platform name>]{job_setting}' instead. Currently, this item will override the corresponding item in global.cylc,but support for this will be removed in Cylc 9.
WARNING - * (8.0.0) '[runtime][foo, cat, dog]execution polling intervals' - this setting is deprecated; use 'global.cylc[platforms][<platform name>]execution polling intervals' instead. Currently, this item will override the corresponding item in global.cylc, but support for this will be removed in Cylc 9.
WARNING - * (8.0.0) '[runtime][foo, cat, dog]submission polling intervals' - this setting is deprecated; use 'global.cylc[platforms][<platform name>]submission polling intervals' instead. Currently, this item will override the corresponding item in global.cylc, but support for this will be removed in Cylc 9.
WARNING - * (8.0.0) '[runtime][foo, cat, dog]submission retry delays' - this setting is deprecated; use 'global.cylc[platforms][<platform name>]submission retry delays' instead. Currently, this item will override the corresponding item in global.cylc, but support for this will be removed in Cylc 9.
13 changes: 9 additions & 4 deletions tests/functional/platforms/02-host-to-platform-upgrade.t
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
# - Task with a host setting that should match the test platform
export REQUIRE_PLATFORM='loc:remote'
. "$(dirname "$0")/test_header"
set_test_number 4
set_test_number 5

install_suite "${TEST_NAME_BASE}" "${TEST_NAME_BASE}"

Expand All @@ -30,14 +30,19 @@ run_fail "${TEST_NAME_BASE}-validate-fail" \
cylc validate "flow2.cylc"

# Ensure that you can validate suite
run_ok "${TEST_NAME_BASE}-validate" \
run_ok "${TEST_NAME_BASE}-run" \
cylc validate "${SUITE_NAME}" \
-s "CYLC_TEST_HOST='${CYLC_TEST_HOST}'" \
-s CYLC_TEST_HOST_FQDN="'$(ssh "$CYLC_TEST_HOST" hostname -f)'"

# Check that the cfgspec/suite.py has issued a warning about upgrades.
grep_ok "\[upgradeable_cylc7_settings\]\[remote\]host = ${CYLC_TEST_HOST}"\
"${TEST_NAME_BASE}-validate.stderr"
grep_ok "\[t1\]\[remote\]host = ${CYLC_TEST_HOST}"\
"${TEST_NAME_BASE}-run.stderr"

# the namespace with the host setting will be logged not the task that
# inherits from it (because it happens in the cfgspec not the config)
grep_ok "\[T2\]\[remote\]host = ${CYLC_TEST_HOST}"\
"${TEST_NAME_BASE}-run.stderr"

# Run the suite
suite_run_ok "${TEST_NAME_BASE}-run" \
Expand Down
12 changes: 10 additions & 2 deletions tests/functional/platforms/02-host-to-platform-upgrade/flow.cylc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[scheduling]
[[graph]]
R1 = """
no_settings & upgradeable_cylc7_settings => fin
no_settings & t1 & t2 => fin
"""

[runtime]
Expand All @@ -15,7 +15,15 @@

[[no_settings, fin]]

[[upgradeable_cylc7_settings]]
[[t1]]
script = test {{CYLC_TEST_HOST_FQDN}} == "$(hostname -f)"
[[[remote]]]
host = {{CYLC_TEST_HOST}}

[[T2]]
script = test {{CYLC_TEST_HOST_FQDN}} == "$(hostname -f)"
[[[remote]]]
host = {{CYLC_TEST_HOST}}

[[t2]]
inherit = T2
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Initial point: 1
Final point: 1
[no_settings.1] -triggered off []
[upgradeable_cylc7_settings.1] -triggered off []
[fin.1] -triggered off ['no_settings.1', 'upgradeable_cylc7_settings.1']
[t1.1] -triggered off []
[t2.1] -triggered off []
[fin.1] -triggered off ['no_settings.1', 't1.1', 't2.1']

0 comments on commit c45aa27

Please sign in to comment.