Skip to content

Commit

Permalink
Validate platform settings.
Browse files Browse the repository at this point in the history
  • Loading branch information
hjoliver committed Jun 28, 2022
1 parent d522ad8 commit 54d613c
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions cylc/flow/cfgspec/globalcfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -1559,6 +1559,7 @@ def load(self) -> None:

self._set_default_editors()
self._no_platform_group_name_overlap()
self._validate_bg_at_platforms()

def _validate_source_dirs(self) -> None:
"""Check source dirs are absolute paths."""
Expand Down Expand Up @@ -1615,6 +1616,23 @@ def _expand_platforms(self):
self.sparse['platforms']
)

def _validate_bg_at_platforms(self):
"""The background and at job runners must have a single host.
(The Job ID is only valid on the exact submission host.)
"""
bad_platforms = []
for name, deets in self.sparse.get('platforms').items():
runner = deets.get('job runner', 'background')
hosts = deets.get('hosts', [])
if runner in ('at', 'background') and len(hosts) > 1:
bad_platforms.append((name, runner, hosts))
if bad_platforms:
msg = '"background" and "at" are single-host job runners:'
for name, runner, hosts in bad_platforms:
msg += f'\n * {name} {runner} hosts: {", ".join(hosts)}'
raise GlobalConfigError(msg)

def platform_dump(
self,
print_platform_names: bool = True,
Expand Down

0 comments on commit 54d613c

Please sign in to comment.