From 2714ca2f9972a5afa3f499ac984ac56d483706e5 Mon Sep 17 00:00:00 2001 From: Thomas Grainger Date: Tue, 24 May 2022 13:54:10 +0100 Subject: [PATCH] run cluster widget periodic callbacks on the correct event loop --- distributed/deploy/cluster.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/distributed/deploy/cluster.py b/distributed/deploy/cluster.py index 13e81f5f82d..d2d0da82ae1 100644 --- a/distributed/deploy/cluster.py +++ b/distributed/deploy/cluster.py @@ -427,10 +427,13 @@ def update(): cluster_repr_interval = parse_timedelta( dask.config.get("distributed.deploy.cluster-repr-interval", default="ms") ) - pc = PeriodicCallback(update, cluster_repr_interval * 1000) - self.periodic_callbacks["cluster-repr"] = pc - pc.start() + def install(): + pc = PeriodicCallback(update, cluster_repr_interval * 1000) + self.periodic_callbacks["cluster-repr"] = pc + pc.start() + + self.loop.add_callback(install) return tab def _repr_html_(self, cluster_status=None):