Skip to content

Commit

Permalink
host select: replace host appointer with host select
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-sanders committed Jan 29, 2020
1 parent 11dc8b3 commit 93dd8fc
Show file tree
Hide file tree
Showing 12 changed files with 10 additions and 1,147 deletions.
7 changes: 1 addition & 6 deletions cylc/flow/cfgspec/globalcfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,12 +272,7 @@
'run ports': [VDR.V_INTEGER_LIST, list(range(43001, 43101))],
'condemned hosts': [VDR.V_ABSOLUTE_HOST_LIST],
'auto restart delay': [VDR.V_INTERVAL],
'thresholds': [VDR.V_STRING],
'run host select': {
'rank': [VDR.V_STRING, 'random', 'load:1', 'load:5', 'load:15',
'memory', 'disk-space'],
'thresholds': [VDR.V_STRING],
},
'thresholds': [VDR.V_STRING]
},
}

Expand Down
298 changes: 0 additions & 298 deletions cylc/flow/host_appointer.py

This file was deleted.

9 changes: 5 additions & 4 deletions cylc/flow/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,13 @@
from cylc.flow.daemonize import daemonize
from cylc.flow.exceptions import (
CylcError,
HostSelectException,
PointParsingError,
SuiteServiceFileError,
TaskProxySequenceBoundsError
)
import cylc.flow.flags
from cylc.flow.host_appointer import HostAppointer, EmptyHostList
from cylc.flow.host_select import select_suite_host
from cylc.flow.hostuserutil import get_host, get_user, get_fqdn_by_host
from cylc.flow.job_pool import JobPool
from cylc.flow.loggingutil import (
Expand Down Expand Up @@ -1357,7 +1358,7 @@ def suite_auto_restart(self, max_retries=3):
cmd = ['cylc', 'restart', quote(self.suite)]

for attempt_no in range(max_retries):
new_host = HostAppointer(cached=False).appoint_host()
new_host = select_suite_host(cached=False)[1]
LOG.info('Attempting to restart on "%s"', new_host)

# proc will start with current env (incl CYLC_HOME etc)
Expand Down Expand Up @@ -1450,8 +1451,8 @@ def can_auto_restart(self):
"""Determine whether this suite can safely auto stop-restart."""
# Check whether there is currently an available host to restart on.
try:
HostAppointer(cached=False).appoint_host()
except EmptyHostList:
select_suite_host(cached=False)
except HostSelectException:
LOG.critical(
'Suite cannot automatically restart because:\n' +
'No alternative host to restart suite on.')
Expand Down
10 changes: 2 additions & 8 deletions cylc/flow/scheduler_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import cylc.flow.flags
from cylc.flow.exceptions import SuiteServiceFileError
from cylc.flow.host_appointer import HostAppointer, EmptyHostList
from cylc.flow.host_select import select_suite_host
from cylc.flow.hostuserutil import is_remote_host
from cylc.flow.option_parsers import CylcOptionParser as COP
from cylc.flow.pathutil import get_suite_run_dir
Expand Down Expand Up @@ -249,13 +249,7 @@ def scheduler_cli(parser, options, args, is_restart=False):

# Check whether a run host is explicitly specified, else select one.
if not options.host:
try:
host = HostAppointer().appoint_host()
except EmptyHostList as exc:
if cylc.flow.flags.debug:
raise
else:
sys.exit(str(exc))
host = select_suite_host()[1]
if is_remote_host(host):
if is_restart:
base_cmd = ["restart"] + sys.argv[1:]
Expand Down
Loading

0 comments on commit 93dd8fc

Please sign in to comment.