Log formatting error when initial state throws error in hwp supervisor
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 17
- Forks
- 20
- Avg merge
- 1h 22m
- Merged PRs (30d)
- 2
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in socs/agents/hwp_supervisor/agent.py at ControlAction's state-setting method around line 769. Reproduce an initial-state error and inspect how txaio.logger formats the resulting event. Decide whether the message should remain one line or use the proposed multiline format, then verify that state-setting logs no longer trigger "Unable to format event".
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100