From 8e7661677eb247c379554e78a0f20667f26b6ec1 Mon Sep 17 00:00:00 2001 From: Dan Allan Date: Mon, 15 Apr 2019 11:17:37 -0400 Subject: [PATCH 1/3] Move timer start out of callback. Instead of checking `is_alive()` on each call of the callback, start the timer outside the callback so it happens exactly once. Using `is_alive()` raised errors once the timer stopped because it returns `False` when the thread *is started* but is also dead. --- nslsii/temperature_controllers.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/nslsii/temperature_controllers.py b/nslsii/temperature_controllers.py index fd0a4264..45fbce82 100644 --- a/nslsii/temperature_controllers.py +++ b/nslsii/temperature_controllers.py @@ -63,13 +63,11 @@ def timer_cleanup(): self.readback.clear_sub(status_indicator) status._finished(success=False) + # Add a Timer to ensure that timeout occurs. self._cb_timer = threading.Timer(self.timeout.get(), timer_cleanup) - + self._cb_timer.start() # set up the done moving indicator logic def status_indicator(value, timestamp, **kwargs): - # add a Timer to ensure that timeout occurs. - if not self._cb_timer.is_alive(): - self._cb_timer.start() nonlocal initial_timestamp if abs(value - set_value) < tolerance: From c490048f640dd51c797bab1aff70b811b10e6b7b Mon Sep 17 00:00:00 2001 From: Dan Allan Date: Mon, 15 Apr 2019 11:19:20 -0400 Subject: [PATCH 2/3] FIX: stop() method must access `success` parameter. --- nslsii/temperature_controllers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nslsii/temperature_controllers.py b/nslsii/temperature_controllers.py index 45fbce82..85482554 100644 --- a/nslsii/temperature_controllers.py +++ b/nslsii/temperature_controllers.py @@ -91,7 +91,7 @@ def status_indicator(value, timestamp, **kwargs): # hand the status object back to the RE return status - def stop(self): + def stop(self, success=False): # overide the lock, cancel the timer and remove the subscription on any # in progress sets self._set_lock.release() From 1ad415688234fba73f8b694bd7df057fb172f56e Mon Sep 17 00:00:00 2001 From: Dan Allan Date: Tue, 16 Apr 2019 13:34:04 -0400 Subject: [PATCH 3/3] Try adding netifaces for caproto. --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index 17f26884..19001688 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,6 +4,7 @@ databroker ipython ipywidgets matplotlib +netifaces numpy ophyd psutil