From 16393efa7c439932095ee007ca4d3ac5c1cb8df6 Mon Sep 17 00:00:00 2001 From: Laurent Stephenson Date: Thu, 12 May 2022 15:13:46 -0600 Subject: [PATCH] fix issue #1890: make dashboard use moninj port from device_db Signed-off-by: Laurent Stephenson --- artiq/dashboard/moninj.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/artiq/dashboard/moninj.py b/artiq/dashboard/moninj.py index a9adc5678..c624529af 100644 --- a/artiq/dashboard/moninj.py +++ b/artiq/dashboard/moninj.py @@ -203,6 +203,7 @@ _WidgetDesc = namedtuple("_WidgetDesc", "uid comment cls arguments") def setup_from_ddb(ddb): mi_addr = None + mi_port = None dds_sysclk = None description = set() @@ -235,14 +236,16 @@ def setup_from_ddb(ddb): description.add(widget) elif v["type"] == "controller" and k == "core_moninj": mi_addr = v["host"] + mi_port = v.get("port_proxy", 1383) except KeyError: pass - return mi_addr, dds_sysclk, description + return mi_addr, mi_port, dds_sysclk, description class _DeviceManager: def __init__(self): self.mi_addr = None + self.mi_port = None self.reconnect_mi = asyncio.Event() self.mi_connection = None self.mi_connector_task = asyncio.ensure_future(self.mi_connector()) @@ -264,10 +267,11 @@ class _DeviceManager: return ddb def notify(self, mod): - mi_addr, dds_sysclk, description = setup_from_ddb(self.ddb) + mi_addr, mi_port, dds_sysclk, description = setup_from_ddb(self.ddb) - if mi_addr != self.mi_addr: + if (mi_addr, mi_port) != (self.mi_addr, self.mi_port): self.mi_addr = mi_addr + self.mi_port = mi_port self.reconnect_mi.set() self.dds_sysclk = dds_sysclk @@ -397,7 +401,7 @@ class _DeviceManager: new_mi_connection = CommMonInj(self.monitor_cb, self.injection_status_cb, self.disconnect_cb) try: - await new_mi_connection.connect(self.mi_addr, 1383) + await new_mi_connection.connect(self.mi_addr, self.mi_port) except asyncio.CancelledError: logger.info("cancelled connection to moninj") break