-
Notifications
You must be signed in to change notification settings - Fork 179
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
fix(api): Report Python protocol line numbers for errors from Protocol Engine #13537
fix(api): Report Python protocol line numbers for errors from Protocol Engine #13537
Conversation
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.
No substantive changes in here, just adding type annotations and rearranging things for readability.
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## chore_release-7.0.0 #13537 +/- ##
=======================================================
- Coverage 71.30% 71.30% -0.01%
=======================================================
Files 2418 2418
Lines 68007 68002 -5
Branches 7896 7896
=======================================================
- Hits 48492 48487 -5
Misses 17668 17668
Partials 1847 1847
Flags with carried forward coverage won't be shown. Click here to find out more.
|
# TODO(mm, 2023-09-12): Do we need to scan the exception tree like this? Instead, can we | ||
# directly inspect the E-stop state through self._hardware_api.get_estop_state()? |
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.
@TamarZanzouri @sfoster1 Thoughts on this # TODO
?
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.
We need to scan the exception tree because someone in theory could have released the estop really fast after pressing it and the physical estop state would not be the same as the one that caused the error.
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.
Mm, yeah, okay.
Would that be likely in practice? I think someone would have to physically release the E-stop button and PUT /robot/control/acknowledgeEstopDisengage
before the exception finishes its journey from the hardware controller to ProtocolEngine.finish()
. (I don't think that means it doesn't matter—just developing a mental model.)
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 good to me! It makes sense and I agree with it. However, I think the todo is wrong - see the inline 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.
LGTM! Thank you!
Overview
Fixes RSS-317.
Test Plan
Changelog
Bug fix: When an exception bubbles out of the Python protocol
exec()
, do not handle it specially just because that exception passed through Protocol Engine. Handle it like any other exception. This lets us attach the protocol line number to it.We were handling it specially before because, I guess, we wanted it to collude with this
isinstance
check up inProtocolEngine.finish()
. Apparently this was unnecessary, because theExceptionInProtocolError
that we would wrap it with passes theisinstance
check just the same.Add some analysis integration tests that make sure the line number shows up.
Resolve some type-checking exclusions in
opentrons.protocols.execute
.Review requests
Risk assessment
Probably medium-high. The special E-stop handling is hard to reason about and unit-test because it works by several far-away places colluding with each other.