Skip to content

Commit 8b9bf22

Browse files
Merge pull request #6643 from oliver-sanders/host-select+force-condemned
host-select: fix compatibility with force-condemned hosts
2 parents 6e18e49 + e9df0c9 commit 8b9bf22

File tree

4 files changed

+56
-9
lines changed

4 files changed

+56
-9
lines changed

changes.d/6623.fix.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Auto restart: The option to condemn a host in "force" mode (that tells
2+
workflows running on a server to shutdown as opposed to migrate) hasn't worked
3+
with the host-selection mechanism since Cylc 8.0.0. This has now been fixed.

cylc/flow/cfgspec/globalcfg.py

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -826,16 +826,52 @@ def default_for(
826826
range.
827827
''')
828828
Conf('condemned', VDR.V_ABSOLUTE_HOST_LIST, desc=f'''
829-
These hosts will not be used to run jobs.
829+
List run hosts that workflows should *not* run on.
830830
831-
If workflows are already running on
832-
condemned hosts, Cylc will shut them down and
833-
restart them on different hosts.
831+
These hosts will be subtracted from the
832+
`available <global.cylc[scheduler][run hosts]>` hosts
833+
preventing new workflows from starting on the "condemned" host.
834+
835+
Any workflows running on these hosts will either migrate
836+
to another host, or shut down according to
837+
:py:mod:`the configuration <cylc.flow.main_loop.auto_restart>`.
838+
839+
This feature requires ``auto restart`` to be listed
840+
in `global.cylc[scheduler][main loop]plugins`.
841+
842+
For more information, see the
843+
:py:mod:`auto restart <cylc.flow.main_loop.auto_restart>`
844+
plugin.
845+
846+
.. rubric:: Example:
847+
848+
.. code-block:: cylc
849+
850+
[scheduler]
851+
[[main loop]]
852+
# activate the "auto restart" plugin
853+
plugins = auto restart
854+
[[run hosts]]
855+
# there are three hosts in the "pool"
856+
available = host1, host2, host3
857+
858+
# however two have been taken out:
859+
# * workflows running on "host1" will attempt to
860+
# restart on "host3"
861+
# * workflows running on "host2" will shutdown
862+
condemned = host1, host2!
834863
835864
.. seealso::
836865
866+
:py:mod:`cylc.flow.main_loop.auto_restart`
837867
:ref:`auto-stop-restart`
838868
869+
.. versionchanged:: 8.4.2
870+
871+
The "force mode" (activated by a "!" suffix) caused issues
872+
at workflow startup for Cylc versions between 8.0.0 and
873+
8.4.1 inclusive.
874+
839875
.. versionchanged:: 8.0.0
840876
841877
{REPLACES}``[suite servers]condemned hosts``.
@@ -1336,7 +1372,7 @@ def default_for(
13361372
The means by which task progress messages are reported back to
13371373
the running workflow.
13381374
1339-
..rubric:: Options:
1375+
.. rubric:: Options:
13401376
13411377
zmq
13421378
Direct client-server TCP communication via network ports

cylc/flow/host_select.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,13 @@ def select_workflow_host(cached=True):
128128
# be returned with the up-to-date configuration.
129129
global_config = glbl_cfg(cached=cached)
130130

131+
# condemned hosts may be suffixed with an "!" to activate "force mode"
132+
blacklist = []
133+
for host in global_config.get(['scheduler', 'run hosts', 'condemned'], []):
134+
if host.endswith('!'):
135+
host = host[:-1]
136+
blacklist.append(host)
137+
131138
return select_host(
132139
# list of workflow hosts
133140
global_config.get([
@@ -138,9 +145,7 @@ def select_workflow_host(cached=True):
138145
'scheduler', 'run hosts', 'ranking'
139146
]),
140147
# list of condemned hosts
141-
blacklist=global_config.get(
142-
['scheduler', 'run hosts', 'condemned']
143-
),
148+
blacklist=blacklist,
144149
blacklist_name='condemned host'
145150
)
146151

tests/functional/restart/43-auto-restart-force-override-normal.t

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ create_test_global_config '' "
5050
${BASE_GLOBAL_CONFIG}
5151
[scheduler]
5252
[[run hosts]]
53-
available = ${CYLC_TEST_HOST_1}
53+
available = ${CYLC_TEST_HOST_1}, ${CYLC_TEST_HOST_2}
54+
# ensure the workflow can start if a host is condemned
55+
# in force mode see #6623
56+
condemned = ${CYLC_TEST_HOST_2}!
5457
"
5558

5659
set_test_number 8

0 commit comments

Comments
 (0)