Skip to content

Conversation

@jlashner
Copy link
Contributor

@jlashner jlashner commented Dec 16, 2024

Description

Motivation and Context

This adds gripper-state monitoring to the HWP monitor process, and adds the following flags to the HWP state which can be checked by the ACU:

  • gripper_state which can be "cold", "warm", "ungripped", or "unknown"
  • is_spinning boolean

How Has This Been Tested?

Along with these changes, I am building out the HWP emulator into a set of integration tests that test the behavior of these flags and other operations.

This has been tested with HWP and ACU hardware on satp1.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.

@jlashner jlashner marked this pull request as ready for review December 17, 2024 22:27
@jlashner
Copy link
Contributor Author

jlashner commented Jan 3, 2025

@BrianJKoopman Ended up getting the tests to work properly! Turns out I missed a shutdown call for one of the device_emulators in the hwp emulator. Adding that makes tests clean up correctly, so I reverted the misc changes I made to test the github workflow.

This contains the same update to the HWP supervisor as #805, so if you'd rather just review and merge this one we can close the other one. Thanks!

Copy link
Member

@BrianJKoopman BrianJKoopman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great, awesome to see all the tests come together for the supervisor agent. Mostly small documentation related comments. The SIGKILL workaround for getting the tests to run does mean code coverage doesn't get reported, which is unfortunate. It's makes it a bit challenging to understand what really gets tested.

@jlashner
Copy link
Contributor Author

Hey Brian, this is now passing tests, having fixed issues with shutting down some agents with SIGINT, and is ready for another review. Thanks!

Copy link
Member

@BrianJKoopman BrianJKoopman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this fixes the issue with SIGKILL in the supervisor tests, but the problem still remains in the PID agent tests when I run locally. Coverage goes from 0% to 95% on the agent if I change the SIGKILL on this line to a SIGINT:

runner.proc.send_signal(signal.SIGKILL)

Tests results running locally with that line sending SIGKILL vs sending SIGINT:

$ python3 -m pytest --cov --cov-report term integration/test_hwp_pid_agent_integration.py
================================================================ test session starts ================================================================
platform linux -- Python 3.11.9, pytest-8.3.3, pluggy-1.5.0
rootdir: /home/koopman/git/socs/tests
configfile: pytest.ini
plugins: order-1.3.0, dependency-0.6.0, cov-6.0.0, docker-3.1.1, twisted-1.14.3, anyio-4.4.0
collected 8 items

integration/test_hwp_pid_agent_integration.py ........                                                                                         [100%]

---------- coverage: platform linux, python 3.11.9-final-0 -----------
Name                                                                             Stmts   Miss  Cover
----------------------------------------------------------------------------------------------------
/home/koopman/git/socs/socs/agents/hwp_pid/agent.py                                210    210     0%
/home/koopman/git/socs/socs/agents/hwp_pid/drivers/pid_controller.py               267    219    18%

$ python3 -m pytest --cov --cov-report term integration/test_hwp_pid_agent_integration.py
================================================================ test session starts ================================================================
platform linux -- Python 3.11.9, pytest-8.3.3, pluggy-1.5.0
rootdir: /home/koopman/git/socs/tests
configfile: pytest.ini
plugins: order-1.3.0, dependency-0.6.0, cov-6.0.0, docker-3.1.1, twisted-1.14.3, anyio-4.4.0
collected 8 items

integration/test_hwp_pid_agent_integration.py ........                                                                                         [100%]

---------- coverage: platform linux, python 3.11.9-final-0 -----------
Name                                                                             Stmts   Miss  Cover
----------------------------------------------------------------------------------------------------
/home/koopman/git/socs/socs/agents/hwp_pid/agent.py                                210     11    95%
/home/koopman/git/socs/socs/agents/hwp_pid/drivers/pid_controller.py               267     69    74%

Is this SIGKILL required in the CI? Tests run fine on my system without it. Or is there a similar solution that would remove the need to send SIGKILL in those tests?

Also, please address or comment on the other comments I made in the last review.

@jlashner
Copy link
Contributor Author

Right, thanks for the reminder. I went through and addressed your previous comments, if you want to take another look!

Copy link
Member

@BrianJKoopman BrianJKoopman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks for working through all the difficulties with the tests!

@BrianJKoopman BrianJKoopman merged commit 4fb4323 into main Jan 17, 2025
5 checks passed
@BrianJKoopman BrianJKoopman deleted the hwp-flags-for-acu branch January 17, 2025 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants