From 54d613cfad6d7a64adea6efa9f2d33fcd74ba2e6 Mon Sep 17 00:00:00 2001 From: Hilary James Oliver Date: Tue, 28 Jun 2022 14:10:52 +1200 Subject: [PATCH] Validate platform settings. --- cylc/flow/cfgspec/globalcfg.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/cylc/flow/cfgspec/globalcfg.py b/cylc/flow/cfgspec/globalcfg.py index b67be463a3c..cb83ee1dd03 100644 --- a/cylc/flow/cfgspec/globalcfg.py +++ b/cylc/flow/cfgspec/globalcfg.py @@ -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.""" @@ -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,