-
Notifications
You must be signed in to change notification settings - Fork 15
SRS CG635: Add ValueError handling #912
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
Conversation
|
Now that #913 is merged, please either rebase or merge in |
|
While you're rebasing/merging, can you also provide some context and post the traceback for the error this is fixing? |
|
@BrianJKoopman Merged in main and added traceback to original post. Looks like tests passed so should be good to go. |
BrianJKoopman
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I just have one comment about the implementation here.
socs/agents/srs_cg635/agent.py
Outdated
| try: | ||
| freq, stdc, runs, timb = self.clock.get_all_status().split(';') | ||
| data['data']['Frequency'] = float(freq) | ||
| data['data']['Standard_CMOS_Output'] = int(stdc) | ||
| data['data']['Running_State'] = int(runs) | ||
| data['data']['Timebase'] = int(timb) | ||
| except ValueError: | ||
| self.clock.clear() | ||
| data['data']['Frequency'] = self.clock.get_freq() | ||
| data['data']['Standard_CMOS_Output'] = self.clock.get_stdc() | ||
| data['data']['Running_State'] = self.clock.get_runs() | ||
| data['data']['Timebase'] = self.clock.get_timebase() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works, but I think would be better suited to go down a level, into the SRSCG635Interface.get_all_status() method. That way the driver is robust to this error, rather than just the agent.
BrianJKoopman
left a comment
There was a problem hiding this 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 the changes!
Description
Add ValueError handling to agent process. Attempts calling the individual driver functions individually if the combined function fails.
Motivation and Context
Error found when agent deployed to site.
Traceback from Loki logs:
The process had ran fine for about an hour, then this error occurred seemingly randomly. I assume something finicky happened when trying to read 4 registers at the same time, so this fix adds the fallback of reading the 4 registers separately.
How Has This Been Tested?
Types of changes
Checklist: