Skip to content

Commit

Permalink
Add flags for ACU checking to hwp supervisor (#802)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
jlashner and pre-commit-ci[bot] authored Jan 17, 2025
1 parent 461c1f0 commit 4fb4323
Show file tree
Hide file tree
Showing 9 changed files with 839 additions and 87 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# A container setup with an installation of socs.

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

# Set up the cryo/smurf user and group so this can run on smurf-servers
# See link for how all other smurf-containers are set up:
Expand Down
11 changes: 10 additions & 1 deletion socs/agents/hwp_encoder/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,14 @@ def __init__(self, beaglebone_port=8080, read_chunk_size=8196):
# Will be continually updated with unix in seconds
self.current_time = 0

# If True, will stop trying to read data from socket
self.stop = False

# Creates a UDP socket to connect to the Beaglebone
self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# This helps with testing and rebinding to the same port after reset...
self.sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)

# Binds the socket to a specific ip address and port
# The ip address can be blank for accepting any UDP packet to the port
self.sock.bind(('', beaglebone_port))
Expand Down Expand Up @@ -303,7 +309,9 @@ def grab_and_parse_data(self):
Error 2: data length is shorter than the IRIG info
even though the IRIG packet header is found.
"""
while True:
self.stop = False

while not self.stop: # This can be toggled by encoder agent to unblock
# If there is data from the socket attached to the beaglebone then
# ready[0] = true
# If not then continue checking for 2 seconds and if there is still no data
Expand Down Expand Up @@ -714,6 +722,7 @@ def _stop_acq(self, session, params=None):
"""
if self.take_data:
self.take_data = False
self.parser.stop = True
return True, 'requested to stop taking data.'

return False, 'acq is not currently running.'
Expand Down
Loading

0 comments on commit 4fb4323

Please sign in to comment.