From e693cbb0a13c5c1e22661364cec602511abc03db Mon Sep 17 00:00:00 2001 From: Tim Pillinger <26465611+wxtim@users.noreply.github.com> Date: Wed, 25 Nov 2020 11:58:56 +0000 Subject: [PATCH 1/7] move suite servers to scheduler section of global config --- cylc/flow/cfgspec/globalcfg.py | 62 +++++++++++++-------------- cylc/flow/host_select.py | 6 +-- cylc/flow/main_loop/auto_restart.py | 16 +++---- cylc/flow/scheduler.py | 2 +- cylc/flow/scheduler_cli.py | 2 +- tests/integration/conftest.py | 2 +- tests/unit/network/test_publisher.py | 2 +- tests/unit/test_host_select.py | 10 ++--- tests/unit/test_host_select_remote.py | 12 +++--- 9 files changed, 56 insertions(+), 58 deletions(-) diff --git a/cylc/flow/cfgspec/globalcfg.py b/cylc/flow/cfgspec/globalcfg.py index fe0940c0e90..11e8095b2ef 100644 --- a/cylc/flow/cfgspec/globalcfg.py +++ b/cylc/flow/cfgspec/globalcfg.py @@ -101,6 +101,36 @@ desc=''' The number of old run directory trees to retain at start-up. ''') + Conf('run hosts', VDR.V_SPACELESS_STRING_LIST, desc=''' + A list of allowed suite run hosts. One of these hosts will be + appointed for a suite to start up on if an explicit host is not + provided as an option to a ``run`` or ``restart`` command. + ''') + Conf('run ports', VDR.V_INTEGER_LIST, list(range(43001, 43101)), + desc=''' + A list of allowed ports for Cylc to use to run suites. + ''') + Conf('condemned hosts', VDR.V_ABSOLUTE_HOST_LIST, desc=''' + Hosts specified in ``condemned hosts`` will not be considered as + suite run hosts. If suites are already running on ``condemned + hosts`` they will be automatically shutdown and restarted (see + :ref:`auto-stop-restart`). + ''') + Conf('auto restart delay', VDR.V_INTERVAL, desc=''' + Relates to Cylc's auto stop-restart mechanism (see + :ref:`auto-stop-restart`). When a host is set to automatically + shutdown/restart it will first wait a random period of time between + zero and ``auto restart delay`` seconds before beginning the + process. This is to prevent large numbers of suites from restarting + simultaneously. + ''') + Conf('ranking', VDR.V_STRING, desc=''' + A multiline string containing Python expressions to filter + and/or rank hosts. For example: + cpu_percent() < 70 + cpu_percent() + to filter by cpu_percent() < 70 then to rank by cpu_percent. + ''') with Conf('events', desc=''' You can define site defaults for each of the following options, @@ -579,38 +609,6 @@ host if you have to use the *hardwired* self-identification method. ''') - # suite - with Conf('suite servers', desc=''' - Configure allowed suite hosts and ports for starting up (running or - restarting) suites. Additionally configure host selection settings - specifying how to determine the most suitable run host at any given - time from those configured. - '''): - Conf('run hosts', VDR.V_SPACELESS_STRING_LIST, desc=''' - A list of allowed suite run hosts. One of these hosts will be - appointed for a suite to start up on if an explicit host is not - provided as an option to a ``run`` or ``restart`` command. - ''') - Conf('run ports', VDR.V_INTEGER_LIST, list(range(43001, 43101)), - desc=''' - A list of allowed ports for Cylc to use to run suites. - ''') - Conf('condemned hosts', VDR.V_ABSOLUTE_HOST_LIST, desc=''' - Hosts specified in ``condemned hosts`` will not be considered as - suite run hosts. If suites are already running on ``condemned - hosts`` they will be automatically shutdown and restarted (see - :ref:`auto-stop-restart`). - ''') - Conf('auto restart delay', VDR.V_INTERVAL, desc=''' - Relates to Cylc's auto stop-restart mechanism (see - :ref:`auto-stop-restart`). When a host is set to automatically - shutdown/restart it will first wait a random period of time between - zero and ``auto restart delay`` seconds before beginning the - process. This is to prevent large numbers of suites from restarting - simultaneously. - ''') - Conf('ranking', VDR.V_STRING) - def upg(cfg, descr): """Upgrader.""" diff --git a/cylc/flow/host_select.py b/cylc/flow/host_select.py index 05de6d795dd..3215aa13e3d 100644 --- a/cylc/flow/host_select.py +++ b/cylc/flow/host_select.py @@ -61,12 +61,12 @@ def select_suite_host(cached=True): return select_host( # list of suite hosts - global_config.get(['suite servers', 'run hosts']) or ['localhost'], + global_config.get(['scheduler', 'run hosts']) or ['localhost'], # rankings to apply - ranking_string=global_config.get(['suite servers', 'ranking']), + ranking_string=global_config.get(['scheduler', 'ranking']), # list of condemned hosts blacklist=global_config.get( - ['suite servers', 'condemned hosts'] + ['scheduler', 'condemned hosts'] ), blacklist_name='condemned host' ) diff --git a/cylc/flow/main_loop/auto_restart.py b/cylc/flow/main_loop/auto_restart.py index f8d035f3e51..de113101c06 100644 --- a/cylc/flow/main_loop/auto_restart.py +++ b/cylc/flow/main_loop/auto_restart.py @@ -16,7 +16,7 @@ """Automatically restart suites if they are running on bad servers. Loads in the global configuration to check if the server a suite is running -on is listed in :cylc:conf:`global.cylc[suite servers]condemned hosts`. +on is listed in :cylc:conf:`global.cylc[scheduler]condemned hosts`. This is useful if a host needs to be taken off-line e.g. for scheduled maintenance. @@ -26,11 +26,11 @@ .. cylc-scope:: global.cylc -- :cylc:conf:`[suite servers]auto restart delay` -- :cylc:conf:`[suite servers]condemned hosts` -- :cylc:conf:`[suite servers]run hosts` +- :cylc:conf:`[scheduler]auto restart delay` +- :cylc:conf:`[scheduler]condemned hosts` +- :cylc:conf:`[scheduler]run hosts` -.. cylc-scope:: global.cylc[suite servers] +.. cylc-scope:: global.cylc[scheduler] The auto stop-restart feature has two modes: @@ -56,7 +56,7 @@ .. code-block:: cylc - [suite servers] + [scheduler] run hosts = pub condemned hosts = foo, bar! @@ -107,7 +107,7 @@ async def auto_restart(scheduler, _): _set_auto_restart( scheduler, restart_delay=current_glbl_cfg.get( - ['suite servers', 'auto restart delay'] + ['scheduler', 'auto restart delay'] ), mode=mode ) @@ -117,7 +117,7 @@ def _should_auto_restart(scheduler, current_glbl_cfg): # check if suite host is condemned - if so auto restart if scheduler.stop_mode is None: for host in current_glbl_cfg.get( - ['suite servers', 'condemned hosts'] + ['scheduler', 'condemned hosts'] ): if host.endswith('!'): # host ends in an `!` -> force shutdown mode diff --git a/cylc/flow/scheduler.py b/cylc/flow/scheduler.py index b6ccc474bda..7d250c005c1 100644 --- a/cylc/flow/scheduler.py +++ b/cylc/flow/scheduler.py @@ -528,7 +528,7 @@ async def configure(self): async def start_servers(self): """Start the TCP servers.""" - port_range = glbl_cfg().get(['suite servers', 'run ports']) + port_range = glbl_cfg().get(['scheduler', 'run ports']) self.server.start(port_range[0], port_range[-1]) self.publisher.start(port_range[0], port_range[-1]) # wait for threads to setup socket ports before continuing diff --git a/cylc/flow/scheduler_cli.py b/cylc/flow/scheduler_cli.py index 824040ccdd4..fbfa04bf584 100644 --- a/cylc/flow/scheduler_cli.py +++ b/cylc/flow/scheduler_cli.py @@ -207,7 +207,7 @@ def get_option_parser(is_restart, add_std_opts=False): help=( "Specify the host on which to start-up the suite. " "If not specified, a host will be selected using " - "the 'suite servers' global config." + "the '[scheduler]run hosts' global config." ), metavar="HOST", action="store", dest="host") diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 1c83fd7060e..9c4f01f9881 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -213,7 +213,7 @@ def _log_filter(log, name=None, level=None, contains=None, regex=None): @pytest.fixture(scope='session') def port_range(): - ports = glbl_cfg().get(['suite servers', 'run ports']) + ports = glbl_cfg().get(['scheduler', 'run ports']) return min(ports), max(ports) diff --git a/tests/unit/network/test_publisher.py b/tests/unit/network/test_publisher.py index 5df91ec1047..ab6063ad470 100644 --- a/tests/unit/network/test_publisher.py +++ b/tests/unit/network/test_publisher.py @@ -24,7 +24,7 @@ @pytest.fixture(scope='session') def port_range(): - ports = glbl_cfg().get(['suite servers', 'run ports']) + ports = glbl_cfg().get(['scheduler', 'run ports']) return min(ports), max(ports) diff --git a/tests/unit/test_host_select.py b/tests/unit/test_host_select.py index 0afcd1f6fb7..26e8b00c9ad 100644 --- a/tests/unit/test_host_select.py +++ b/tests/unit/test_host_select.py @@ -138,7 +138,7 @@ def test_suite_host_select(mock_glbl_cfg): mock_glbl_cfg( 'cylc.flow.host_select.glbl_cfg', f''' - [suite servers] + [scheduler] run hosts = {localhost} ''' ) @@ -150,7 +150,7 @@ def test_suite_host_select_default(mock_glbl_cfg): mock_glbl_cfg( 'cylc.flow.host_select.glbl_cfg', ''' - [suite servers] + [scheduler] run hosts = ''' ) @@ -169,7 +169,7 @@ def test_suite_host_select_condemned(mock_glbl_cfg): mock_glbl_cfg( 'cylc.flow.host_select.glbl_cfg', f''' - [suite servers] + [scheduler] run hosts = {localhost} condemned hosts = {localhost_fqdn} ''' @@ -181,7 +181,7 @@ def test_suite_host_select_condemned(mock_glbl_cfg): def test_condemned_host_ambiguous(mock_glbl_cfg): - """Test the [suite servers]condemend host coercer + """Test the [scheduler]condemend host coercer Not actually host_select code but related functionality. """ @@ -189,7 +189,7 @@ def test_condemned_host_ambiguous(mock_glbl_cfg): mock_glbl_cfg( 'cylc.flow.host_select.glbl_cfg', f''' - [suite servers] + [scheduler] run hosts = {localhost} condemned hosts = {localhost} ''' diff --git a/tests/unit/test_host_select_remote.py b/tests/unit/test_host_select_remote.py index ebd95fdf621..2a3820bd44b 100644 --- a/tests/unit/test_host_select_remote.py +++ b/tests/unit/test_host_select_remote.py @@ -130,11 +130,11 @@ def mocked_get_metrics(hosts, metrics, _=None): def test_remote_suite_host_select(mock_glbl_cfg): - """test [suite servers]run hosts""" + """test [scheduler]run hosts""" mock_glbl_cfg( 'cylc.flow.host_select.glbl_cfg', f''' - [suite servers] + [scheduler] run hosts = {remote_platform} ''' ) @@ -142,11 +142,11 @@ def test_remote_suite_host_select(mock_glbl_cfg): def test_remote_suite_host_condemned(mock_glbl_cfg): - """test [suite servers]condemned hosts""" + """test [scheduler]condemned hosts""" mock_glbl_cfg( 'cylc.flow.host_select.glbl_cfg', f''' - [suite servers] + [scheduler] run hosts = {remote_platform}, {local_host} condemned hosts = {remote_platform} ''' @@ -156,11 +156,11 @@ def test_remote_suite_host_condemned(mock_glbl_cfg): def test_remote_suite_host_rankings(mock_glbl_cfg): - """test [suite servers]rankings""" + """test [scheduler]rankings""" mock_glbl_cfg( 'cylc.flow.host_select.glbl_cfg', f''' - [suite servers] + [scheduler] run hosts = {remote_platform} ranking = """ # if this test fails due to race conditions From 40b9dae34a8e7a1c76cd26f9a2450ba70468948d Mon Sep 17 00:00:00 2001 From: Tim Pillinger <26465611+wxtim@users.noreply.github.com> Date: Wed, 25 Nov 2020 16:17:57 +0000 Subject: [PATCH 2/7] fixed 2 flakyfunctional tests I'd missed --- .../restart/39-auto-restart-no-suitable-host.t | 4 ++-- tests/flakyfunctional/restart/40-auto-restart-force-stop.t | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/flakyfunctional/restart/39-auto-restart-no-suitable-host.t b/tests/flakyfunctional/restart/39-auto-restart-no-suitable-host.t index cabe1b5f238..84dd77d50e0 100644 --- a/tests/flakyfunctional/restart/39-auto-restart-no-suitable-host.t +++ b/tests/flakyfunctional/restart/39-auto-restart-no-suitable-host.t @@ -44,7 +44,7 @@ init_suite "${TEST_NAME_BASE}" <<< ' create_test_global_config '' " ${BASE_GLOBAL_CONFIG} -[suite servers] +[scheduler] run hosts = localhost " @@ -53,7 +53,7 @@ poll_suite_running create_test_global_config '' " ${BASE_GLOBAL_CONFIG} -[suite servers] +[scheduler] run hosts = localhost condemned hosts = $(localhost_fqdn) " diff --git a/tests/flakyfunctional/restart/40-auto-restart-force-stop.t b/tests/flakyfunctional/restart/40-auto-restart-force-stop.t index aa9968d28d0..2f93c8617db 100644 --- a/tests/flakyfunctional/restart/40-auto-restart-force-stop.t +++ b/tests/flakyfunctional/restart/40-auto-restart-force-stop.t @@ -40,7 +40,7 @@ init_suite "${TEST_NAME_BASE}" <<< ' create_test_global_config '' " ${BASE_GLOBAL_CONFIG} -[suite servers] +[scheduler] run hosts = localhost " @@ -49,7 +49,7 @@ poll_suite_running create_test_global_config '' " ${BASE_GLOBAL_CONFIG} -[suite servers] +[scheduler] run hosts = localhost condemned hosts = $(localhost_fqdn)! " From 3235d53e4601e6ec4bb9a90d377b28aace652ca7 Mon Sep 17 00:00:00 2001 From: Tim Pillinger <26465611+wxtim@users.noreply.github.com> Date: Thu, 26 Nov 2020 10:25:29 +0000 Subject: [PATCH 3/7] Moved [suite servers] items to [scheduler][run hosts] --- cylc/flow/cfgspec/globalcfg.py | 67 ++++++++++--------- cylc/flow/host_select.py | 10 ++- cylc/flow/main_loop/auto_restart.py | 2 +- cylc/flow/scheduler.py | 2 +- .../39-auto-restart-no-suitable-host.t | 8 ++- .../restart/40-auto-restart-force-stop.t | 8 ++- .../restart/34-auto-restart-basic.t | 10 +-- .../restart/35-auto-restart-recovery.t | 10 +-- .../restart/37-auto-restart-delay.t | 16 +++-- .../restart/38-auto-restart-stopping.t | 9 +-- .../restart/41-auto-restart-local-jobs.t | 19 +++--- .../restart/42-auto-restart-ping-pong.t | 7 +- .../43-auto-restart-force-override-normal.t | 19 +++--- tests/integration/conftest.py | 2 +- tests/unit/network/test_publisher.py | 2 +- tests/unit/test_host_select.py | 16 +++-- tests/unit/test_host_select_remote.py | 31 +++++---- 17 files changed, 137 insertions(+), 101 deletions(-) diff --git a/cylc/flow/cfgspec/globalcfg.py b/cylc/flow/cfgspec/globalcfg.py index 11e8095b2ef..c5bd54b36f1 100644 --- a/cylc/flow/cfgspec/globalcfg.py +++ b/cylc/flow/cfgspec/globalcfg.py @@ -101,36 +101,43 @@ desc=''' The number of old run directory trees to retain at start-up. ''') - Conf('run hosts', VDR.V_SPACELESS_STRING_LIST, desc=''' - A list of allowed suite run hosts. One of these hosts will be - appointed for a suite to start up on if an explicit host is not - provided as an option to a ``run`` or ``restart`` command. - ''') - Conf('run ports', VDR.V_INTEGER_LIST, list(range(43001, 43101)), - desc=''' - A list of allowed ports for Cylc to use to run suites. - ''') - Conf('condemned hosts', VDR.V_ABSOLUTE_HOST_LIST, desc=''' - Hosts specified in ``condemned hosts`` will not be considered as - suite run hosts. If suites are already running on ``condemned - hosts`` they will be automatically shutdown and restarted (see - :ref:`auto-stop-restart`). - ''') - Conf('auto restart delay', VDR.V_INTERVAL, desc=''' - Relates to Cylc's auto stop-restart mechanism (see - :ref:`auto-stop-restart`). When a host is set to automatically - shutdown/restart it will first wait a random period of time between - zero and ``auto restart delay`` seconds before beginning the - process. This is to prevent large numbers of suites from restarting - simultaneously. - ''') - Conf('ranking', VDR.V_STRING, desc=''' - A multiline string containing Python expressions to filter - and/or rank hosts. For example: - cpu_percent() < 70 - cpu_percent() - to filter by cpu_percent() < 70 then to rank by cpu_percent. - ''') + with Conf('run hosts', desc=''' + Configure allowed suite hosts and ports for starting up (running or + restarting) suites. Additionally configure host selection settings + specifying how to determine the most suitable run host at any given + time from those configured. + '''): + Conf('available', VDR.V_SPACELESS_STRING_LIST, desc=''' + A list of allowed suite run hosts. One of these hosts will be + appointed for a suite to start up on if an explicit host is not + provided as an option to a ``run`` or ``restart`` command. + ''') + Conf( + 'ports', VDR.V_INTEGER_LIST, list(range(43001, 43101)), + desc=''' + A list of allowed ports for Cylc to use to run suites. + ''') + Conf('condemned', VDR.V_ABSOLUTE_HOST_LIST, desc=''' + Hosts specified in ``condemned hosts`` will not be considered + as suite run hosts. If suites are already running on + ``condemned hosts`` they will be automatically shutdown and + restarted (see:ref:`auto-stop-restart`). + ''') + Conf('auto restart delay', VDR.V_INTERVAL, desc=''' + Relates to Cylc's auto stop-restart mechanism (see + :ref:`auto-stop-restart`). When a host is set to automatically + shutdown/restart it will first wait a random period of time + between zero and ``auto restart delay`` seconds before + beginning the process. This is to prevent large numbers of + suites from restarting simultaneously. + ''') + Conf('ranking', VDR.V_STRING, desc=''' + A multiline string containing Python expressions to filter + and/or rank hosts. For example: + cpu_percent() < 70 + cpu_percent() + to filter by cpu_percent() < 70 then to rank by cpu_percent. + ''') with Conf('events', desc=''' You can define site defaults for each of the following options, diff --git a/cylc/flow/host_select.py b/cylc/flow/host_select.py index 3215aa13e3d..a290833b634 100644 --- a/cylc/flow/host_select.py +++ b/cylc/flow/host_select.py @@ -61,12 +61,16 @@ def select_suite_host(cached=True): return select_host( # list of suite hosts - global_config.get(['scheduler', 'run hosts']) or ['localhost'], + global_config.get([ + 'scheduler', 'run hosts', 'available' + ]) or ['localhost'], # rankings to apply - ranking_string=global_config.get(['scheduler', 'ranking']), + ranking_string=global_config.get([ + 'scheduler', 'run hosts', 'ranking' + ]), # list of condemned hosts blacklist=global_config.get( - ['scheduler', 'condemned hosts'] + ['scheduler', 'run hosts', 'condemned'] ), blacklist_name='condemned host' ) diff --git a/cylc/flow/main_loop/auto_restart.py b/cylc/flow/main_loop/auto_restart.py index de113101c06..811f5bab99e 100644 --- a/cylc/flow/main_loop/auto_restart.py +++ b/cylc/flow/main_loop/auto_restart.py @@ -117,7 +117,7 @@ def _should_auto_restart(scheduler, current_glbl_cfg): # check if suite host is condemned - if so auto restart if scheduler.stop_mode is None: for host in current_glbl_cfg.get( - ['scheduler', 'condemned hosts'] + ['scheduler', 'run hosts', 'condemned'] ): if host.endswith('!'): # host ends in an `!` -> force shutdown mode diff --git a/cylc/flow/scheduler.py b/cylc/flow/scheduler.py index 7d250c005c1..20feb21ce2c 100644 --- a/cylc/flow/scheduler.py +++ b/cylc/flow/scheduler.py @@ -528,7 +528,7 @@ async def configure(self): async def start_servers(self): """Start the TCP servers.""" - port_range = glbl_cfg().get(['scheduler', 'run ports']) + port_range = glbl_cfg().get(['scheduler', 'run hosts', 'ports']) self.server.start(port_range[0], port_range[-1]) self.publisher.start(port_range[0], port_range[-1]) # wait for threads to setup socket ports before continuing diff --git a/tests/flakyfunctional/restart/39-auto-restart-no-suitable-host.t b/tests/flakyfunctional/restart/39-auto-restart-no-suitable-host.t index 84dd77d50e0..c9692326ad2 100644 --- a/tests/flakyfunctional/restart/39-auto-restart-no-suitable-host.t +++ b/tests/flakyfunctional/restart/39-auto-restart-no-suitable-host.t @@ -45,7 +45,8 @@ init_suite "${TEST_NAME_BASE}" <<< ' create_test_global_config '' " ${BASE_GLOBAL_CONFIG} [scheduler] - run hosts = localhost + [[run hosts]] + available = localhost " cylc run "${SUITE_NAME}" --debug @@ -54,8 +55,9 @@ poll_suite_running create_test_global_config '' " ${BASE_GLOBAL_CONFIG} [scheduler] - run hosts = localhost - condemned hosts = $(localhost_fqdn) + [[run hosts]] + available = localhost + condemned = $(localhost_fqdn) " FILE=$(cylc cat-log "${SUITE_NAME}" -m p |xargs readlink -f) diff --git a/tests/flakyfunctional/restart/40-auto-restart-force-stop.t b/tests/flakyfunctional/restart/40-auto-restart-force-stop.t index 2f93c8617db..ac32fc70cd0 100644 --- a/tests/flakyfunctional/restart/40-auto-restart-force-stop.t +++ b/tests/flakyfunctional/restart/40-auto-restart-force-stop.t @@ -41,7 +41,8 @@ init_suite "${TEST_NAME_BASE}" <<< ' create_test_global_config '' " ${BASE_GLOBAL_CONFIG} [scheduler] - run hosts = localhost + [[run hosts]] + available = localhost " cylc run "${SUITE_NAME}" --hold @@ -50,8 +51,9 @@ poll_suite_running create_test_global_config '' " ${BASE_GLOBAL_CONFIG} [scheduler] - run hosts = localhost - condemned hosts = $(localhost_fqdn)! + [[run hosts]] + available = localhost + condemned = $(localhost_fqdn)! " FILE=$(cylc cat-log "${SUITE_NAME}" -m p |xargs readlink -f) diff --git a/tests/functional/restart/34-auto-restart-basic.t b/tests/functional/restart/34-auto-restart-basic.t index f9663e80a70..f90e0616daa 100644 --- a/tests/functional/restart/34-auto-restart-basic.t +++ b/tests/functional/restart/34-auto-restart-basic.t @@ -33,8 +33,9 @@ BASE_GLOBAL_CONFIG=" abort on timeout = True inactivity = PT1M timeout = PT1M -[suite servers] - run hosts = localhost, ${CYLC_TEST_HOST}" +[scheduler] + [[run hosts]] + available = localhost, ${CYLC_TEST_HOST}" TEST_NAME="${TEST_NAME_BASE}" TEST_DIR="$HOME/cylc-run/" init_suite "${TEST_NAME}" - <<'__FLOW_CONFIG__' @@ -55,8 +56,9 @@ cylc suite-state "${SUITE_NAME}" --task='task_foo01' \ # condemn localhost create_test_global_config '' " ${BASE_GLOBAL_CONFIG} -[suite servers] - condemned hosts = $(hostname) +[scheduler] + [[run hosts]] + condemned = $(hostname) " # test shutdown procedure - scan the first log file FILE=$(cylc cat-log "${SUITE_NAME}" -m p |xargs readlink -f) diff --git a/tests/functional/restart/35-auto-restart-recovery.t b/tests/functional/restart/35-auto-restart-recovery.t index 51962953796..ea609228b9e 100644 --- a/tests/functional/restart/35-auto-restart-recovery.t +++ b/tests/functional/restart/35-auto-restart-recovery.t @@ -31,8 +31,9 @@ BASE_GLOBAL_CONFIG=" abort on timeout = True inactivity = PT2M timeout = PT2M -[suite servers] - run hosts = localhost, ${CYLC_TEST_HOST}" +[scheduler] + [[run hosts]] + available = localhost, ${CYLC_TEST_HOST}" TEST_NAME="${TEST_NAME_BASE}" TEST_DIR="$HOME/cylc-run/" init_suite "${TEST_NAME}" <<< ' @@ -51,8 +52,9 @@ rm "${SUITE_RUN_DIR}/flow.cylc" # condemn localhost create_test_global_config '' " ${BASE_GLOBAL_CONFIG} -[suite servers] - condemned hosts = $(hostname) +[scheduler] + [[run hosts]] + condemned = $(hostname) " FILE=$(cylc cat-log "${SUITE_NAME}" -m p |xargs readlink -f) diff --git a/tests/functional/restart/37-auto-restart-delay.t b/tests/functional/restart/37-auto-restart-delay.t index 7c57359190e..e3bd0b65571 100644 --- a/tests/functional/restart/37-auto-restart-delay.t +++ b/tests/functional/restart/37-auto-restart-delay.t @@ -53,9 +53,10 @@ TEST_DIR="$HOME/cylc-run/" init_suite "${TEST_NAME_BASE}" <<< ' MAX_RESTART_DELAY=30 create_test_global_config '' " ${BASE_GLOBAL_CONFIG} -[suite servers] - run hosts = localhost - auto restart delay = PT${MAX_RESTART_DELAY}S +[scheduler] + [[run hosts]] + available = localhost + auto restart delay = PT${MAX_RESTART_DELAY}S " # Run suite. @@ -65,10 +66,11 @@ poll_suite_running # Condemn host - trigger stop-restart. create_test_global_config '' " ${BASE_GLOBAL_CONFIG} -[suite servers] - run hosts = ${CYLC_TEST_HOST} - condemned hosts = $(hostname) - auto restart delay = PT20S +[scheduler] + [[run hosts]] + available = ${CYLC_TEST_HOST} + condemned = $(hostname) + auto restart delay = PT20S " # Check stop-restart working. diff --git a/tests/functional/restart/38-auto-restart-stopping.t b/tests/functional/restart/38-auto-restart-stopping.t index feac867388a..04123cff984 100644 --- a/tests/functional/restart/38-auto-restart-stopping.t +++ b/tests/functional/restart/38-auto-restart-stopping.t @@ -32,8 +32,8 @@ BASE_GLOBAL_CONFIG=" abort on timeout = True inactivity = PT1M timeout = PT1M -[suite servers] - run hosts = localhost, ${CYLC_TEST_HOST}" + [[run hosts]] + available = localhost, ${CYLC_TEST_HOST}" TEST_NAME="${TEST_NAME_BASE}" @@ -57,8 +57,9 @@ cylc suite-state "${SUITE_NAME}" --task='foo' --status='running' --point=1 \ # condemn localhost create_test_global_config '' " ${BASE_GLOBAL_CONFIG} -[suite servers] - condemned hosts = $(hostname) +[scheduler] + [[run hosts]] + condemned = $(hostname) " # wait for suite to die of natural causes diff --git a/tests/functional/restart/41-auto-restart-local-jobs.t b/tests/functional/restart/41-auto-restart-local-jobs.t index a8967357ffd..77d106e067a 100644 --- a/tests/functional/restart/41-auto-restart-local-jobs.t +++ b/tests/functional/restart/41-auto-restart-local-jobs.t @@ -49,8 +49,9 @@ TEST_DIR="$HOME/cylc-run/" init_suite "${TEST_NAME_BASE}" <<< ' create_test_global_config '' " ${BASE_GLOBAL_CONFIG} -[suite servers] - run hosts = ${CYLC_TEST_HOST1} +[scheduler] + [[run hosts]] + available = ${CYLC_TEST_HOST1} " cylc run "${SUITE_NAME}" @@ -64,9 +65,10 @@ cylc suite-state "${SUITE_NAME}" --task='foo' --status='running' --point=1 \ create_test_global_config '' " ${BASE_GLOBAL_CONFIG} -[suite servers] - run hosts = ${CYLC_TEST_HOST1}, ${CYLC_TEST_HOST2} - condemned hosts = ${CYLC_TEST_HOST1} +[scheduler] + [[run hosts]] + available = ${CYLC_TEST_HOST1}, ${CYLC_TEST_HOST2} + condemned = ${CYLC_TEST_HOST1} " FILE="$(cylc cat-log "${SUITE_NAME}" -m p |xargs readlink -f)" @@ -94,9 +96,10 @@ cylc suite-state "${SUITE_NAME}" --task='bar' --status='running' --point=1 \ create_test_global_config '' " ${BASE_GLOBAL_CONFIG} -[suite servers] - run hosts = ${CYLC_TEST_HOST1}, ${CYLC_TEST_HOST2} - condemned hosts = ${CYLC_TEST_HOST2}! +[scheduler] + [[run hosts]] + available = ${CYLC_TEST_HOST1}, ${CYLC_TEST_HOST2} + condemned = ${CYLC_TEST_HOST2}! " FILE="$(cylc cat-log "${SUITE_NAME}" -m p |xargs readlink -f)" diff --git a/tests/functional/restart/42-auto-restart-ping-pong.t b/tests/functional/restart/42-auto-restart-ping-pong.t index bc3492d729a..8f75739dd58 100644 --- a/tests/functional/restart/42-auto-restart-ping-pong.t +++ b/tests/functional/restart/42-auto-restart-ping-pong.t @@ -52,9 +52,10 @@ stuck_in_the_middle() { JOKERS="${CLOWNS}"; CLOWNS="${temp}" create_test_global_config '' " ${BASE_GLOBAL_CONFIG} - [suite servers] - run hosts = ${JOKERS}, ${CLOWNS} - condemned hosts = ${CLOWNS} + [scheduling] + [[run hosts]] + available = ${JOKERS}, ${CLOWNS} + condemned = ${CLOWNS} " } diff --git a/tests/functional/restart/43-auto-restart-force-override-normal.t b/tests/functional/restart/43-auto-restart-force-override-normal.t index 969fe68e066..4299e245075 100644 --- a/tests/functional/restart/43-auto-restart-force-override-normal.t +++ b/tests/functional/restart/43-auto-restart-force-override-normal.t @@ -46,8 +46,9 @@ TEST_DIR="$HOME/cylc-run/" init_suite "${TEST_NAME_BASE}" <<< ' create_test_global_config '' " ${BASE_GLOBAL_CONFIG} -[suite servers] - run hosts = ${CYLC_TEST_HOST_1} +[scheduler] + [[run hosts]] + available = ${CYLC_TEST_HOST_1} " set_test_number 7 @@ -61,10 +62,11 @@ FILE=$(cylc cat-log "${SUITE_NAME}" -m p |xargs readlink -f) # condemn the host, the suite will schedule restart in PT60S create_test_global_config '' " ${BASE_GLOBAL_CONFIG} -[suite servers] - run hosts = ${CYLC_TEST_HOST_1}, ${CYLC_TEST_HOST_2} - condemned hosts = ${CYLC_TEST_HOST_1} - auto restart delay = -PT60S # results in +PT60S delay +[scheduler] + [[run hosts]] + available = ${CYLC_TEST_HOST_1}, ${CYLC_TEST_HOST_2} + condemned = ${CYLC_TEST_HOST_1} + auto restart delay = -PT60S # results in +PT60S delay " log_scan "${TEST_NAME_BASE}-stop" "${FILE}" 40 1 \ 'The Cylc suite host will soon become un-available' \ @@ -73,8 +75,9 @@ log_scan "${TEST_NAME_BASE}-stop" "${FILE}" 40 1 \ # condemn the host in "Force Mode", this should cancel the scheduled restart create_test_global_config '' " ${BASE_GLOBAL_CONFIG} -[suite servers] - condemned hosts = ${CYLC_TEST_HOST_1}! +[scheduler] + [[run hosts]] + condemned hosts = ${CYLC_TEST_HOST_1}! " log_scan "${TEST_NAME_BASE}-stop" "${FILE}" 40 1 \ 'This suite will be shutdown as the suite host is' \ diff --git a/tests/integration/conftest.py b/tests/integration/conftest.py index 9c4f01f9881..d8d7de88d45 100644 --- a/tests/integration/conftest.py +++ b/tests/integration/conftest.py @@ -213,7 +213,7 @@ def _log_filter(log, name=None, level=None, contains=None, regex=None): @pytest.fixture(scope='session') def port_range(): - ports = glbl_cfg().get(['scheduler', 'run ports']) + ports = glbl_cfg().get(['scheduler', 'run hosts', 'ports']) return min(ports), max(ports) diff --git a/tests/unit/network/test_publisher.py b/tests/unit/network/test_publisher.py index ab6063ad470..c3533a10a15 100644 --- a/tests/unit/network/test_publisher.py +++ b/tests/unit/network/test_publisher.py @@ -24,7 +24,7 @@ @pytest.fixture(scope='session') def port_range(): - ports = glbl_cfg().get(['scheduler', 'run ports']) + ports = glbl_cfg().get(['scheduler', 'run hosts', 'ports']) return min(ports), max(ports) diff --git a/tests/unit/test_host_select.py b/tests/unit/test_host_select.py index 26e8b00c9ad..917515d1216 100644 --- a/tests/unit/test_host_select.py +++ b/tests/unit/test_host_select.py @@ -139,7 +139,8 @@ def test_suite_host_select(mock_glbl_cfg): 'cylc.flow.host_select.glbl_cfg', f''' [scheduler] - run hosts = {localhost} + [[run hosts]] + available= {localhost} ''' ) assert select_suite_host() == (localhost, localhost_fqdn) @@ -151,7 +152,8 @@ def test_suite_host_select_default(mock_glbl_cfg): 'cylc.flow.host_select.glbl_cfg', ''' [scheduler] - run hosts = + [[run hosts]] + available = ''' ) hostname, host_fqdn = select_suite_host() @@ -170,8 +172,9 @@ def test_suite_host_select_condemned(mock_glbl_cfg): 'cylc.flow.host_select.glbl_cfg', f''' [scheduler] - run hosts = {localhost} - condemned hosts = {localhost_fqdn} + [[run hosts]] + available = {localhost} + condemned = {localhost_fqdn} ''' ) with pytest.raises(HostSelectException) as excinfo: @@ -190,8 +193,9 @@ def test_condemned_host_ambiguous(mock_glbl_cfg): 'cylc.flow.host_select.glbl_cfg', f''' [scheduler] - run hosts = {localhost} - condemned hosts = {localhost} + [[run hosts]] + available = {localhost} + condemned = {localhost} ''' ) assert 'ambiguous host' in excinfo.value.msg diff --git a/tests/unit/test_host_select_remote.py b/tests/unit/test_host_select_remote.py index 2a3820bd44b..36ee3772c95 100644 --- a/tests/unit/test_host_select_remote.py +++ b/tests/unit/test_host_select_remote.py @@ -130,25 +130,27 @@ def mocked_get_metrics(hosts, metrics, _=None): def test_remote_suite_host_select(mock_glbl_cfg): - """test [scheduler]run hosts""" + """test [scheduler][run hosts]available""" mock_glbl_cfg( 'cylc.flow.host_select.glbl_cfg', f''' [scheduler] - run hosts = {remote_platform} + [[run hosts]] + available = {remote_platform} ''' ) assert select_suite_host() == (remote_platform, remote_platform_fqdn) def test_remote_suite_host_condemned(mock_glbl_cfg): - """test [scheduler]condemned hosts""" + """test [scheduler][run hosts]condemned hosts""" mock_glbl_cfg( 'cylc.flow.host_select.glbl_cfg', f''' [scheduler] - run hosts = {remote_platform}, {local_host} - condemned hosts = {remote_platform} + [[run hosts]] + available = {remote_platform}, {local_host} + condemned = {remote_platform} ''' ) for _ in range(10): @@ -156,19 +158,20 @@ def test_remote_suite_host_condemned(mock_glbl_cfg): def test_remote_suite_host_rankings(mock_glbl_cfg): - """test [scheduler]rankings""" + """test [scheduler][run hosts]rankings""" mock_glbl_cfg( 'cylc.flow.host_select.glbl_cfg', f''' [scheduler] - run hosts = {remote_platform} - ranking = """ - # if this test fails due to race conditions - # then you are very lucky - virtual_memory().available > 123456789123456789 - cpu_count() > 512 - disk_usage('/').free > 123456789123456789 - """ + [[run hosts]] + available = {remote_platform} + ranking = """ + # if this test fails due to race conditions + # then you are very lucky + virtual_memory().available > 123456789123456789 + cpu_count() > 512 + disk_usage('/').free > 123456789123456789 + """ ''' ) with pytest.raises(HostSelectException) as excinfo: From b4063e2ad0e61dabcc8a8256b09d9af14c79d898 Mon Sep 17 00:00:00 2001 From: Tim Pillinger <26465611+wxtim@users.noreply.github.com> Date: Thu, 26 Nov 2020 10:44:02 +0000 Subject: [PATCH 4/7] moved suite host self-identification to schediler section --- cylc/flow/cfgspec/globalcfg.py | 89 ++++++++++--------- cylc/flow/hostuserutil.py | 6 +- tests/functional/lib/bash/test_header | 2 +- .../suite-host-self-id/00-address.t | 7 +- 4 files changed, 54 insertions(+), 50 deletions(-) diff --git a/cylc/flow/cfgspec/globalcfg.py b/cylc/flow/cfgspec/globalcfg.py index c5bd54b36f1..1da5b4d3400 100644 --- a/cylc/flow/cfgspec/globalcfg.py +++ b/cylc/flow/cfgspec/globalcfg.py @@ -139,6 +139,52 @@ to filter by cpu_percent() < 70 then to rank by cpu_percent. ''') + with Conf('host self-identification', desc=''' + The suite host's identity must be determined locally by cylc and + passed to running tasks (via ``$CYLC_SUITE_HOST``) so that task + messages can target the right suite on the right host. + + .. todo + Is it conceivable that different remote task hosts at the same site + might see the suite host differently? If so we would need to be + able to override the target in suite configurations. + '''): + Conf('method', VDR.V_STRING, 'name', options=[ + 'name', 'address', 'hardwired' + ], + desc=''' + This item determines how cylc finds the identity of the suite + host.For the default *name* method cylc asks the suite host + for its host name. This should resolve on remote task hosts to + the IP address of the suite host; if it doesn't, adjust + network settings or use one of the other methods. For the + *address* method, cylc attempts to use a special external + "target address" to determine the IP address of the suite + host as seen by remote task hosts. And finally, as a + last resort, you can choose the *hardwired* method and manually + specify the host name or IP address of the suite host. + + Options: + + name + Self-identified host name. + address + Automatically determined IP address (requires *target*). + hardwired + Manually specified host name or IP address (requires *host*). + ''') + Conf('target', VDR.V_STRING, 'google.com', desc=''' + This item is required for the *address* self-identification + method. If your suite host sees the internet, a common address + such as ``google.com`` will do; otherwise choose a host + visible on your intranet. + ''') + Conf('host', VDR.V_STRING, desc=''' + Use this item to explicitly set the name or IP address of the + suite host if you have to use the *hardwired* + self-identification method. + ''') + with Conf('events', desc=''' You can define site defaults for each of the following options, details of which can be found under @@ -573,49 +619,6 @@ Conf('from', VDR.V_STRING) Conf('to', VDR.V_STRING) - # suite - with Conf('suite host self-identification', desc=''' - The suite host's identity must be determined locally by cylc and passed - to running tasks (via ``$CYLC_SUITE_HOST``) so that task messages can - target the right suite on the right host. - - .. todo - Is it conceivable that different remote task hosts at the same site - might see the suite host differently? If so we would need to be able - to override the target in suite configurations. - '''): - Conf('method', VDR.V_STRING, 'name', - options=['name', 'address', 'hardwired'], desc=''' - This item determines how cylc finds the identity of the suite host. - For the default *name* method cylc asks the suite host for its host - name. This should resolve on remote task hosts to the IP address of - the suite host; if it doesn't, adjust network settings or use one - of the other methods. For the *address* method, cylc attempts to - use a special external "target address" to determine the IP address - of the suite host as seen by remote task hosts. And finally, as a - last resort, you can choose the *hardwired* method and manually - specify the host name or IP address of the suite host. - - Options: - - name - Self-identified host name. - address - Automatically determined IP address (requires *target*). - hardwired - Manually specified host name or IP address (requires *host*). - ''') - Conf('target', VDR.V_STRING, 'google.com', desc=''' - This item is required for the *address* self-identification method. - If your suite host sees the internet, a common address such as - ``google.com`` will do; otherwise choose a host visible on your - intranet. - ''') - Conf('host', VDR.V_STRING, desc=''' - Use this item to explicitly set the name or IP address of the suite - host if you have to use the *hardwired* self-identification method. - ''') - def upg(cfg, descr): """Upgrader.""" diff --git a/cylc/flow/hostuserutil.py b/cylc/flow/hostuserutil.py index f1ff39dd55a..21e51735ed2 100644 --- a/cylc/flow/hostuserutil.py +++ b/cylc/flow/hostuserutil.py @@ -125,13 +125,13 @@ def _get_host_info(self, target=None): @staticmethod def _get_identification_cfg(key): """Return the [suite host self-identification]key global conf.""" - return glbl_cfg().get(['suite host self-identification', key]) + return glbl_cfg().get(['scheduler', 'host self-identification', key]) def get_host(self): """Return the preferred identifier for the suite (or current) host. - As specified by the "suite host self-identification" settings in the - site/user global.cylc files. This is mainly used for suite host + As specified by the "[scheduler][host self-identification]" settings in + the site/user global.cylc files. This is mainly used for suite host identification by task jobs. """ diff --git a/tests/functional/lib/bash/test_header b/tests/functional/lib/bash/test_header index c3ea0436772..eeab952df51 100644 --- a/tests/functional/lib/bash/test_header +++ b/tests/functional/lib/bash/test_header @@ -700,7 +700,7 @@ create_test_global_config() { # Tidy in case of previous use of this function. rm -fr 'etc' mkdir 'etc' - # Suite host self-identification method. + # Scheduler host self-identification method. echo "$PRE" >'etc/global.cylc' USER_TESTS_CONF_FILE="${HOME}/.cylc/flow/$(cylc version)/global-tests.cylc" if [[ -f "${USER_TESTS_CONF_FILE}" ]]; then diff --git a/tests/functional/suite-host-self-id/00-address.t b/tests/functional/suite-host-self-id/00-address.t index cb24916dbab..308bc310733 100644 --- a/tests/functional/suite-host-self-id/00-address.t +++ b/tests/functional/suite-host-self-id/00-address.t @@ -31,15 +31,16 @@ __PYTHON__ #------------------------------------------------------------------------------- MY_INET_TARGET=$( \ - cylc get-global-config '--item=[suite host self-identification]target') + cylc get-global-config '--item=[scheduler][host self-identification]target') MY_HOST_IP="$(get_local_ip_address "${MY_INET_TARGET}")" run_ok "${TEST_NAME_BASE}-validate" \ cylc validate "${SUITE_NAME}" "--set=MY_HOST_IP=${MY_HOST_IP}" create_test_global_config '' ' -[suite host self-identification] - method = address' +[scheduler] + [[host self-identification]] + method = address' suite_run_ok "${TEST_NAME_BASE}-run" \ cylc run --reference-test --debug --no-detach "${SUITE_NAME}" \ "--set=MY_HOST_IP=${MY_HOST_IP}" From 24fd8406b5b2a731ab54d62c7f6fd94de4303ded Mon Sep 17 00:00:00 2001 From: Tim Pillinger <26465611+wxtim@users.noreply.github.com> Date: Thu, 26 Nov 2020 11:53:04 +0000 Subject: [PATCH 5/7] Update cylc/flow/cfgspec/globalcfg.py Co-authored-by: Ronnie Dutta <61982285+MetRonnie@users.noreply.github.com> --- cylc/flow/cfgspec/globalcfg.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cylc/flow/cfgspec/globalcfg.py b/cylc/flow/cfgspec/globalcfg.py index 1da5b4d3400..eb9874cba27 100644 --- a/cylc/flow/cfgspec/globalcfg.py +++ b/cylc/flow/cfgspec/globalcfg.py @@ -102,11 +102,11 @@ The number of old run directory trees to retain at start-up. ''') with Conf('run hosts', desc=''' - Configure allowed suite hosts and ports for starting up (running or - restarting) suites. Additionally configure host selection settings - specifying how to determine the most suitable run host at any given - time from those configured. - '''): + Configure allowed suite hosts and ports for starting up (running or + restarting) suites. Additionally configure host selection settings + specifying how to determine the most suitable run host at any given + time from those configured. + '''): Conf('available', VDR.V_SPACELESS_STRING_LIST, desc=''' A list of allowed suite run hosts. One of these hosts will be appointed for a suite to start up on if an explicit host is not From 1aa283c83cf02abe434ec49fb443d556a8defdeb Mon Sep 17 00:00:00 2001 From: Tim Pillinger <26465611+wxtim@users.noreply.github.com> Date: Thu, 26 Nov 2020 11:53:35 +0000 Subject: [PATCH 6/7] Update cylc/flow/cfgspec/globalcfg.py Co-authored-by: Ronnie Dutta <61982285+MetRonnie@users.noreply.github.com> --- cylc/flow/cfgspec/globalcfg.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cylc/flow/cfgspec/globalcfg.py b/cylc/flow/cfgspec/globalcfg.py index eb9874cba27..d395f9ed3cc 100644 --- a/cylc/flow/cfgspec/globalcfg.py +++ b/cylc/flow/cfgspec/globalcfg.py @@ -112,10 +112,9 @@ appointed for a suite to start up on if an explicit host is not provided as an option to a ``run`` or ``restart`` command. ''') - Conf( - 'ports', VDR.V_INTEGER_LIST, list(range(43001, 43101)), - desc=''' - A list of allowed ports for Cylc to use to run suites. + Conf('ports', VDR.V_INTEGER_LIST, list(range(43001, 43101)), + desc=''' + A list of allowed ports for Cylc to use to run suites. ''') Conf('condemned', VDR.V_ABSOLUTE_HOST_LIST, desc=''' Hosts specified in ``condemned hosts`` will not be considered From bdeac72e1996469bf06d8558a22117b3eab590df Mon Sep 17 00:00:00 2001 From: Tim Pillinger <26465611+wxtim@users.noreply.github.com> Date: Thu, 26 Nov 2020 12:02:25 +0000 Subject: [PATCH 7/7] moved auto restart delay --- cylc/flow/cfgspec/globalcfg.py | 64 ++++++++++--------- cylc/flow/main_loop/auto_restart.py | 15 +++-- .../restart/37-auto-restart-delay.t | 4 +- .../43-auto-restart-force-override-normal.t | 2 +- 4 files changed, 46 insertions(+), 39 deletions(-) diff --git a/cylc/flow/cfgspec/globalcfg.py b/cylc/flow/cfgspec/globalcfg.py index d395f9ed3cc..20f396e6afd 100644 --- a/cylc/flow/cfgspec/globalcfg.py +++ b/cylc/flow/cfgspec/globalcfg.py @@ -101,6 +101,14 @@ desc=''' The number of old run directory trees to retain at start-up. ''') + Conf('auto restart delay', VDR.V_INTERVAL, desc=''' + Relates to Cylc's auto stop-restart mechanism (see + :ref:`auto-stop-restart`). When a host is set to automatically + shutdown/restart it will first wait a random period of time + between zero and ``auto restart delay`` seconds before + beginning the process. This is to prevent large numbers of + suites from restarting simultaneously. + ''') with Conf('run hosts', desc=''' Configure allowed suite hosts and ports for starting up (running or restarting) suites. Additionally configure host selection settings @@ -122,14 +130,6 @@ ``condemned hosts`` they will be automatically shutdown and restarted (see:ref:`auto-stop-restart`). ''') - Conf('auto restart delay', VDR.V_INTERVAL, desc=''' - Relates to Cylc's auto stop-restart mechanism (see - :ref:`auto-stop-restart`). When a host is set to automatically - shutdown/restart it will first wait a random period of time - between zero and ``auto restart delay`` seconds before - beginning the process. This is to prevent large numbers of - suites from restarting simultaneously. - ''') Conf('ranking', VDR.V_STRING, desc=''' A multiline string containing Python expressions to filter and/or rank hosts. For example: @@ -148,29 +148,33 @@ might see the suite host differently? If so we would need to be able to override the target in suite configurations. '''): - Conf('method', VDR.V_STRING, 'name', options=[ - 'name', 'address', 'hardwired' - ], + Conf( + 'method', VDR.V_STRING, 'name', + options=['name', 'address', 'hardwired'], desc=''' - This item determines how cylc finds the identity of the suite - host.For the default *name* method cylc asks the suite host - for its host name. This should resolve on remote task hosts to - the IP address of the suite host; if it doesn't, adjust - network settings or use one of the other methods. For the - *address* method, cylc attempts to use a special external - "target address" to determine the IP address of the suite - host as seen by remote task hosts. And finally, as a - last resort, you can choose the *hardwired* method and manually - specify the host name or IP address of the suite host. - - Options: - - name - Self-identified host name. - address - Automatically determined IP address (requires *target*). - hardwired - Manually specified host name or IP address (requires *host*). + This item determines how cylc finds the identity of the + suite host.For the default *name* method cylc asks the + suite host + for its host name. This should resolve on remote task + hosts to + the IP address of the suite host; if it doesn't, adjust + network settings or use one of the other methods. For the + *address* method, cylc attempts to use a special external + "target address" to determine the IP address of the suite + host as seen by remote task hosts. And finally, as a + last resort, you can choose the *hardwired* method and + manually + specify the host name or IP address of the suite host. + + Options: + + name + Self-identified host name. + address + Automatically determined IP address (requires *target*). + hardwired + Manually specified host name or IP address (requires + *host*). ''') Conf('target', VDR.V_STRING, 'google.com', desc=''' This item is required for the *address* self-identification diff --git a/cylc/flow/main_loop/auto_restart.py b/cylc/flow/main_loop/auto_restart.py index 811f5bab99e..141255f01b4 100644 --- a/cylc/flow/main_loop/auto_restart.py +++ b/cylc/flow/main_loop/auto_restart.py @@ -27,8 +27,8 @@ .. cylc-scope:: global.cylc - :cylc:conf:`[scheduler]auto restart delay` -- :cylc:conf:`[scheduler]condemned hosts` -- :cylc:conf:`[scheduler]run hosts` +- :cylc:conf:`[scheduler][run hosts]condemned` +- :cylc:conf:`[scheduler][run hosts]available` .. cylc-scope:: global.cylc[scheduler] @@ -57,8 +57,9 @@ .. code-block:: cylc [scheduler] - run hosts = pub - condemned hosts = foo, bar! + [[run hosts]] + available = pub + condemned = foo, bar! .. warning:: @@ -67,9 +68,11 @@ are evaluated on the suite host server. To prevent large numbers of suites attempting to restart simultaneously the -:cylc:conf:`auto restart delay` setting defines a period of time in seconds. +:cylc:conf:`[scheduler]auto restart delay` setting defines a period of time in +seconds. Suites will wait for a random period of time between zero and -:cylc:conf:`auto restart delay` seconds before attempting to stop and restart. +:cylc:conf:`[scheduler]auto restart delay` seconds before attempting to stop +and restart. Suites that are started up in no-detach mode cannot auto stop-restart on a different host - as it will still end up attached to the condemned host. diff --git a/tests/functional/restart/37-auto-restart-delay.t b/tests/functional/restart/37-auto-restart-delay.t index e3bd0b65571..c51bda701b1 100644 --- a/tests/functional/restart/37-auto-restart-delay.t +++ b/tests/functional/restart/37-auto-restart-delay.t @@ -54,9 +54,9 @@ MAX_RESTART_DELAY=30 create_test_global_config '' " ${BASE_GLOBAL_CONFIG} [scheduler] + auto restart delay = PT${MAX_RESTART_DELAY}S [[run hosts]] available = localhost - auto restart delay = PT${MAX_RESTART_DELAY}S " # Run suite. @@ -67,10 +67,10 @@ poll_suite_running create_test_global_config '' " ${BASE_GLOBAL_CONFIG} [scheduler] + auto restart delay = PT20S [[run hosts]] available = ${CYLC_TEST_HOST} condemned = $(hostname) - auto restart delay = PT20S " # Check stop-restart working. diff --git a/tests/functional/restart/43-auto-restart-force-override-normal.t b/tests/functional/restart/43-auto-restart-force-override-normal.t index 4299e245075..cfe1feab43f 100644 --- a/tests/functional/restart/43-auto-restart-force-override-normal.t +++ b/tests/functional/restart/43-auto-restart-force-override-normal.t @@ -63,10 +63,10 @@ FILE=$(cylc cat-log "${SUITE_NAME}" -m p |xargs readlink -f) create_test_global_config '' " ${BASE_GLOBAL_CONFIG} [scheduler] + auto restart delay = -PT60S # results in +PT60S delay [[run hosts]] available = ${CYLC_TEST_HOST_1}, ${CYLC_TEST_HOST_2} condemned = ${CYLC_TEST_HOST_1} - auto restart delay = -PT60S # results in +PT60S delay " log_scan "${TEST_NAME_BASE}-stop" "${FILE}" 40 1 \ 'The Cylc suite host will soon become un-available' \