Skip to content

Commit 4fb4323

Browse files
Add flags for ACU checking to hwp supervisor (#802)
* Adds flags for ACU checking to hwp supervisor, along with tests * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Try using random port for encoder * Try using random port for encoder * Bump ocs version * Patch runner shutdown function with SIGKILL * Adds query_hwp_state task to supervisor to force state update * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * flake8 and bugfixes * bugfixes * Place emulator in try/catch * mark hwp supervisor tests as integtest * test * test * check open processes in test * Adds psutil to testing reqs * test finally to close ibootbar outlet * change sigint to sigkil for snmp tests * Join on snmp processes * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * test leftover process detection * Lingering subprocess detector * pytest workflow debugging * Add gripper device shutdown * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * revert unnecessary changes made during testing * Add sleep back to scpi test * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Switch testing agents to use SIGINT and unblock parser from trying to grab data when acq is stopped * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Increase timeout for agents in supervisor test * Flake8 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * Addresses Brian's feedback * Flake 8 * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 461c1f0 commit 4fb4323

File tree

9 files changed

+839
-87
lines changed

9 files changed

+839
-87
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# A container setup with an installation of socs.
33

44
# Use the ocs image as a base
5-
FROM simonsobs/ocs:v0.11.3-3-g63fd5ef
5+
FROM simonsobs/ocs:v0.11.3-19-gd729e04
66

77
# Set up the cryo/smurf user and group so this can run on smurf-servers
88
# See link for how all other smurf-containers are set up:

socs/agents/hwp_encoder/agent.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,14 @@ def __init__(self, beaglebone_port=8080, read_chunk_size=8196):
185185
# Will be continually updated with unix in seconds
186186
self.current_time = 0
187187

188+
# If True, will stop trying to read data from socket
189+
self.stop = False
190+
188191
# Creates a UDP socket to connect to the Beaglebone
189192
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
193+
# This helps with testing and rebinding to the same port after reset...
194+
self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
195+
190196
# Binds the socket to a specific ip address and port
191197
# The ip address can be blank for accepting any UDP packet to the port
192198
self.sock.bind(('', beaglebone_port))
@@ -303,7 +309,9 @@ def grab_and_parse_data(self):
303309
Error 2: data length is shorter than the IRIG info
304310
even though the IRIG packet header is found.
305311
"""
306-
while True:
312+
self.stop = False
313+
314+
while not self.stop: # This can be toggled by encoder agent to unblock
307315
# If there is data from the socket attached to the beaglebone then
308316
# ready[0] = true
309317
# If not then continue checking for 2 seconds and if there is still no data
@@ -714,6 +722,7 @@ def _stop_acq(self, session, params=None):
714722
"""
715723
if self.take_data:
716724
self.take_data = False
725+
self.parser.stop = True
717726
return True, 'requested to stop taking data.'
718727

719728
return False, 'acq is not currently running.'

0 commit comments

Comments
 (0)