From 9d1384af963bc34a84c80d9d5f10b0cd829243fd Mon Sep 17 00:00:00 2001 From: Jan David Mol <mol@astron.nl> Date: Tue, 2 Nov 2021 17:23:10 +0100 Subject: [PATCH] L2SS-449: Actually read new values when waiting for the value to change --- .../tangostationcontrol/devices/lofar_device.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/tangostationcontrol/tangostationcontrol/devices/lofar_device.py b/tangostationcontrol/tangostationcontrol/devices/lofar_device.py index 49ce86bfb..0c13cf057 100644 --- a/tangostationcontrol/tangostationcontrol/devices/lofar_device.py +++ b/tangostationcontrol/tangostationcontrol/devices/lofar_device.py @@ -15,7 +15,7 @@ from abc import abstractmethod # PyTango imports from tango.server import Device, command, DeviceMeta, attribute -from tango import AttrWriteType, DevState, DebugIt, Attribute, DeviceProxy +from tango import AttrWriteType, DevState, DebugIt, Attribute, DeviceProxy, DevFailed import time import math @@ -284,13 +284,11 @@ class lofar_device(Device, metaclass=AbstractDeviceMetas): pollperiod: how often to check the attribute, in seconds. """ - attr = getattr(self.proxy, attr_name) - # Poll every half a second for _ in range(math.ceil(timeout/pollperiod)): - if attr != value: + if getattr(self.proxy, attr_name) != value: return time.sleep(pollperiod) - raise Exception(f"{attr} != {value} after f{timeout} seconds still.") + raise Exception(f"{attr_name} != {value} after {timeout} seconds still.") -- GitLab