From 2cde7ae125f34ec247af5481e4d9d8232f8616a7 Mon Sep 17 00:00:00 2001 From: Oliver Sanders Date: Tue, 8 Oct 2024 15:27:55 +0100 Subject: [PATCH] broadcast: fix dictionary changed size during iteration error * Closes #6222 --- changes.d/6397.fix.md | 1 + cylc/flow/data_store_mgr.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changes.d/6397.fix.md diff --git a/changes.d/6397.fix.md b/changes.d/6397.fix.md new file mode 100644 index 00000000000..589c29dbb11 --- /dev/null +++ b/changes.d/6397.fix.md @@ -0,0 +1 @@ +Fix "dictionary changed size during iteration error" which could occur with broadcasts. diff --git a/cylc/flow/data_store_mgr.py b/cylc/flow/data_store_mgr.py index bfadadfb55a..3b49050f0ff 100644 --- a/cylc/flow/data_store_mgr.py +++ b/cylc/flow/data_store_mgr.py @@ -2251,7 +2251,9 @@ def delta_broadcast(self): def _generate_broadcast_node_deltas(self, node_data, node_type): cfg = self.schd.config.cfg - for node_id, node in node_data.items(): + # NOTE: node_data may change during operation so make a copy + # see https://github.com/cylc/cylc-flow/pull/6397 + for node_id, node in list(node_data.items()): tokens = Tokens(node_id) new_runtime = runtime_from_config( self._apply_broadcasts_to_runtime(