Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log formatting error when initial state throws error in hwp supervisor #810

Open
BrianJKoopman opened this issue Jan 3, 2025 · 0 comments
Assignees
Labels
agent: hwp supervisor bug Something isn't working

Comments

@BrianJKoopman
Copy link
Member

Originally posted by @ykyohei in https://github.com/simonsobs/chwp-discussions/discussions/31.

If the initial state of a ControlAction throws an error the txaio.logger will also error out with the usual "Unable to format event" message. This can be fixed with something like:

diff --git a/socs/agents/hwp_supervisor/agent.py b/socs/agents/hwp_supervisor/agent.py
index 3957b126..4c9d1cfd 100644
--- a/socs/agents/hwp_supervisor/agent.py
+++ b/socs/agents/hwp_supervisor/agent.py
@@ -769,7 +769,7 @@ class ControlAction:
         """
         self.cur_state_info = ControlStateInfo(state)
         self.state_history.append(self.cur_state_info)
-        self.log.info(f"Setting state: {state}")
+        self.log.info(f"Setting state:\n{state}", state=state)
         if isinstance(state, ControlState.completed_states):
             self.completed = True
         if isinstance(state, ControlState.Done):

This will make every state setting log two lines, which maybe we don't always want? Will leave it up to @jlashner.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
agent: hwp supervisor bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants