Skip to content

Commit

Permalink
MNT: Add timeout to puts
Browse files Browse the repository at this point in the history
  • Loading branch information
jacquelinegarrahan committed Aug 20, 2020
1 parent de6193e commit 07b065e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lume_epics/client/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,21 +227,23 @@ def get_image(self, pvname) -> dict:
return DEFAULT_IMAGE_DATA


def put(self, pvname, value: Union[np.ndarray, float]) -> None:
def put(self, pvname, value: Union[np.ndarray, float], timeout=1.0) -> None:
"""Assign the value of a process variable.
Args:
pvname (str): Name of the process variable
value (Union[np.ndarray, float]): Value to assing to process variable.
timeout (float): Operation timeout in seconds
"""
self.setup_pv_monitor(pvname)
if self.protocol == "ca":
self.pv_registry[pvname]["pv"].put(value, timeout=0.5)
self.pv_registry[pvname]["pv"].put(value, timeout=timeout)

elif self.protocol == "pva":
self.context.put(pvname, value, throw=False)
self.context.put(pvname, value, throw=False, timeout=timeout)

def close(self):
if self.protocol == "pva":
Expand Down

0 comments on commit 07b065e

Please sign in to comment.