Skip to content

Commit

Permalink
auto stop-restart: change 'auto restart delay' from int to interval
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-sanders committed Oct 31, 2018
1 parent d2e4956 commit 3a68810
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/cylc/cfgspec/globalcfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@
'scan hosts': [VDR.V_STRING_LIST],
'scan ports': [VDR.V_INTEGER_LIST, range(43001, 43101)],
'condemned hosts': [VDR.V_STRING_LIST],
'auto restart delay': [VDR.V_INTEGER, 0],
'auto restart delay': [VDR.V_INTERVAL],
'run host select': {
'rank': [VDR.V_STRING, 'random', 'load:1', 'load:5', 'load:15',
'memory', 'disk-space'],
Expand Down
5 changes: 3 additions & 2 deletions lib/cylc/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1374,13 +1374,14 @@ def suite_auto_restart(self, max_retries=3):
'manual restart required.' % max_retries)
return False

def set_auto_restart(self, restart_delay=0):
def set_auto_restart(self, restart_delay=None):
"""Configure the suite to automatically stop and restart.
Restart handled by `suite_auto_restart`.
Args:
restart_delay (int): Suite will wait a random period between 0 and
restart_delay (cylc.cfgvalidate.DurationFloat):
Suite will wait a random period between 0 and
`restart_delay` seconds before attempting to stop/restart in
order to avoid multiple suites restarting simultaneously.
Expand Down
4 changes: 2 additions & 2 deletions tests/restart/37-auto-restart-delay.t
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ create_test_globalrc '' "
${BASE_GLOBALRC}
[suite servers]
run hosts = localhost
auto restart delay = $MAX_RESTART_DELAY
auto restart delay = PT${MAX_RESTART_DELAY}S
"

# Run suite.
Expand All @@ -72,7 +72,7 @@ ${BASE_GLOBALRC}
[suite servers]
run hosts = ${CYLC_TEST_HOST}
condemned hosts = localhost
auto restart delay = 20
auto restart delay = PT20S
"

# Check stop-restart working.
Expand Down

0 comments on commit 3a68810

Please sign in to comment.