From 9e8bb3c70140438b205a7bfc83ff5ae94cfcce94 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Thu, 12 Jan 2023 12:17:16 +0800 Subject: [PATCH] browser,dashboard: fix asyncio loop management --- artiq/frontend/artiq_browser.py | 4 ++-- artiq/frontend/artiq_dashboard.py | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/artiq/frontend/artiq_browser.py b/artiq/frontend/artiq_browser.py index 204ac2382..49517f9cb 100755 --- a/artiq/frontend/artiq_browser.py +++ b/artiq/frontend/artiq_browser.py @@ -83,7 +83,7 @@ class Browser(QtWidgets.QMainWindow): self.applets = applets.AppletsDock(self, datasets_sub) smgr.register(self.applets) - atexit_register_coroutine(self.applets.stop) + atexit_register_coroutine(self.applets.stop, loop=loop) self.datasets = datasets.DatasetsDock( datasets_sub, master_host, master_port) @@ -162,7 +162,7 @@ def main(): browser.show() smgr.load() smgr.start() - atexit_register_coroutine(smgr.stop) + atexit_register_coroutine(smgr.stop, loop=loop) if args.select is not None: browser.files.select(args.select) diff --git a/artiq/frontend/artiq_dashboard.py b/artiq/frontend/artiq_dashboard.py index dfe1e82d6..31060fb81 100755 --- a/artiq/frontend/artiq_dashboard.py +++ b/artiq/frontend/artiq_dashboard.py @@ -148,7 +148,7 @@ def main(): report_disconnect) loop.run_until_complete(subscriber.connect( args.server, args.port_notify)) - atexit_register_coroutine(subscriber.close) + atexit_register_coroutine(subscriber.close, loop=loop) sub_clients[notifier_name] = subscriber broadcast_clients = dict() @@ -156,7 +156,7 @@ def main(): client = Receiver(target, [], report_disconnect) loop.run_until_complete(client.connect( args.server, args.port_broadcast)) - atexit_register_coroutine(client.close) + atexit_register_coroutine(client.close, loop=loop) broadcast_clients[target] = client # initialize main window @@ -196,13 +196,13 @@ def main(): "port_notify": args.port_notify, "port_control": args.port_control, }) - atexit_register_coroutine(d_applets.stop) + atexit_register_coroutine(d_applets.stop, loop=loop) smgr.register(d_applets) broadcast_clients["ccb"].notify_cbs.append(d_applets.ccb_notify) d_ttl_dds = moninj.MonInj(rpc_clients["schedule"]) loop.run_until_complete(d_ttl_dds.start(args.server, args.port_notify)) - atexit_register_coroutine(d_ttl_dds.stop) + atexit_register_coroutine(d_ttl_dds.stop, loop=loop) d_schedule = schedule.ScheduleDock( rpc_clients["schedule"], sub_clients["schedule"]) @@ -232,7 +232,7 @@ def main(): main_window.show() smgr.load() smgr.start() - atexit_register_coroutine(smgr.stop) + atexit_register_coroutine(smgr.stop, loop=loop) # work around for https://github.com/m-labs/artiq/issues/1307 d_ttl_dds.ttl_dock.show()