From 4b58b31d2bf141d9d9ea63a84318e56a93892614 Mon Sep 17 00:00:00 2001
From: Jan David Mol <mol@astron.nl>
Date: Wed, 13 Oct 2021 19:32:58 +0200
Subject: [PATCH] L2SS-391: Obtain proxies in separate thread because it may
 stall

---
 devices/devices/boot.py | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/devices/devices/boot.py b/devices/devices/boot.py
index 7c14f7955..03969f9cf 100644
--- a/devices/devices/boot.py
+++ b/devices/devices/boot.py
@@ -59,13 +59,7 @@ class DevicesInitialiser(Thread):
     def __init__(self, device_names, ignore_unavailable_devices=True, proxy_timeout=10.0):
         self.ignore_unavailable_devices = ignore_unavailable_devices
 
-        # Since Python3.7+, the insertion order equals the iteration order, which is what we depend on
-        # to process the devices in the same order as in device_names.
-        self.devices = {name: DeviceProxy(name) for name in device_names}
-
-        # set the timeout for all proxies
-        for device in self.devices.values():
-            device.set_timeout_millis(int(proxy_timeout * 1000))
+        self.device_names = device_names
 
         # setup initial state
         self.progress = 0
@@ -77,7 +71,17 @@ class DevicesInitialiser(Thread):
         self.set_status("Starting initialisation")
 
         try:
-            self.initialise_devices()
+            # Since Python3.7+, the insertion order equals the iteration order, which is what we depend on
+            # to process the devices in the same order as in device_names.
+            self.devices = {}
+            for name in self.device_names:
+                self.set_status(f"Obtaining a DeviceProxy to {name}")
+                self.devices[name] = DeviceProxy(name)
+
+            # set the timeout for all proxies
+            for device in self.devices.values():
+                device.set_timeout_millis(int(proxy_timeout * 1000))
+                self.initialise_devices()
 
             self.set_status("Initialisation completed")
         except Exception as e:
-- 
GitLab