|
32 | 32 | from cylc.flow.exceptions import PointParsingError
|
33 | 33 | from cylc.flow.parsec.util import listjoin, pdeepcopy, poverride
|
34 | 34 | from cylc.flow.parsec.validate import BroadcastConfigValidator
|
| 35 | +from cylc.flow.platforms import ( |
| 36 | + fail_if_platform_and_host_conflict, |
| 37 | + PlatformLookupError, |
| 38 | +) |
| 39 | + |
35 | 40 |
|
36 | 41 | if TYPE_CHECKING:
|
37 | 42 | from cylc.flow.id import Tokens
|
@@ -62,9 +67,10 @@ class BroadcastMgr:
|
62 | 67 |
|
63 | 68 | REC_SECTION = re.compile(r"\[([^\]]+)\]")
|
64 | 69 |
|
65 |
| - def __init__(self, workflow_db_mgr, data_store_mgr): |
66 |
| - self.workflow_db_mgr = workflow_db_mgr |
67 |
| - self.data_store_mgr = data_store_mgr |
| 70 | + def __init__(self, schd): |
| 71 | + self.schd = schd |
| 72 | + self.workflow_db_mgr = schd.workflow_db_mgr |
| 73 | + self.data_store_mgr = schd.data_store_mgr |
68 | 74 | self.linearized_ancestors = {}
|
69 | 75 | self.broadcasts = {}
|
70 | 76 | self.ext_triggers = {} # Can use collections.Counter in future
|
@@ -304,6 +310,14 @@ def put_broadcast(
|
304 | 310 | if namespace not in self.linearized_ancestors:
|
305 | 311 | bad_namespaces.append(namespace)
|
306 | 312 | elif not bad_point:
|
| 313 | + self.check_for_old_and_new_platform_settings( |
| 314 | + self.schd.config.get_config( |
| 315 | + ['runtime', namespace] |
| 316 | + ).copy(), |
| 317 | + namespace, |
| 318 | + coerced_setting, |
| 319 | + ) |
| 320 | + |
307 | 321 | if namespace not in self.broadcasts[point_string]:
|
308 | 322 | self.broadcasts[point_string][namespace] = {}
|
309 | 323 |
|
@@ -332,6 +346,21 @@ def put_broadcast(
|
332 | 346 | self.data_store_mgr.delta_broadcast()
|
333 | 347 | return modified_settings, bad_options
|
334 | 348 |
|
| 349 | + @staticmethod |
| 350 | + def check_for_old_and_new_platform_settings( |
| 351 | + task_config, namespace, coerced_setting |
| 352 | + ): |
| 353 | + """Check for combination of old ([remote]host) and new (platform) |
| 354 | + settings in the task config as it will be after merger. |
| 355 | + """ |
| 356 | + task_config.update(coerced_setting) |
| 357 | + try: |
| 358 | + fail_if_platform_and_host_conflict( |
| 359 | + task_config, namespace |
| 360 | + ) |
| 361 | + except PlatformLookupError as exc: |
| 362 | + LOG.error('Cannot apply broadcast:\n' + '\n '.join(exc.args)) |
| 363 | + |
335 | 364 | @staticmethod
|
336 | 365 | def _cancel_keys_in_prunes(prunes, cancel_keys):
|
337 | 366 | """Is cancel_keys pruned?"""
|
|
0 commit comments