Code indexing in gitaly is broken and leads to code not being visible to the user. We work on the issue with highest priority.

Skip to content
Snippets Groups Projects
Commit c794dc44 authored by augustin_s's avatar augustin_s :snake:
Browse files

added DataPutter class

parent f0ea0dd2
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,7 @@ class DataGetter:
self.timeout = timeout
self.quiet = quiet
def __call__(self, pv):
connected = pv.wait_for_connection(self.timeout)
......@@ -41,7 +42,47 @@ class DataGetter:
if not self.quiet:
msg = colored(col, msg)
print(pv.pvname, msg)
return data
class DataPutter:
def __init__(self, timeout, quiet):
self.timeout = timeout
self.quiet = quiet
def __call__(self, pv, value):
connected = pv.wait_for_connection(self.timeout)
if not connected:
status = False
msg = MSG_NOT_CONNECTED
col = COL_NOT_CONNECTED
else:
status = pv_put_waiting(pv, value, self.timeout) #TODO: use same timeout twice?
msg = f"put {value} "
if status:
msg += "successful"
col = COL_SUCCESS
else:
msg += "timed out"
col = COL_ALARM
if not self.quiet:
msg = colored(col, msg)
print(pv.pvname, msg)
return status
def pv_put_waiting(pv, value, timeout):
"""wraps waiting PV.put and returns completion status"""
pv.put(value, wait=True, timeout=timeout, use_complete=True)
return pv.put_complete
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment