-
Notifications
You must be signed in to change notification settings - Fork 178
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(robot-server): fix robot-server blinker task startup causing hw init failure on the Flex. #16483
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.
Nice catch, thanks.
I think we could do this a bit less intrusively and preserve more of the non-buggy parts of #16286.
From your description and from the stack trace in the ticket, it seems like my mistake was specifically this chunk:
opentrons/robot-server/robot_server/hardware.py
Lines 158 to 164 in a301877
async def blink_forever() -> None: | |
while True: | |
# This should no-op on a Flex. | |
await hardware.set_lights(button=True) | |
await asyncio.sleep(0.5) | |
await hardware.set_lights(button=False) | |
await asyncio.sleep(0.5) |
The bug is that, contrary to the comment, it only mostly no-ops—if the Flex is undergoing a firmware update, it raises.
So could we solve this by any of the following:
- Making
hardware.set_lights(button=...)
actually always no-op on a Flex - Having
FrontButtonLightBlinker.start_blinking()
check the robot type and avoid callinghardware.set_lights(button=...)
if it's a Flex - Having
FrontButtonLightBlinker.start_blinking()
check the firmware update status and avoid callinghardware.set_lights(button=...)
if there's an update in progress - Having the calling code in
app_setup.py
avoid callingblinker.start_blinking()
if it's a Flex - Adding a commented
contextlib.suppress
ortry
/except
anywhere
My thinking is that I would really prefer to avoid going back a bunch of free functions that interact with each other through app_state
, if we can help it. And I think that scope and lifetime stuff is orthogonal to the missing-conditional problem that you've identified.
Valid points, although
|
Correct, I would like to move away from that.
Not totally following these points—let's talk about them in-person. |
1121fa7
to
a874ebe
Compare
We spoke IRL, I have de-coupled the bug fix from the re-factor work I was trying to do so we can move this forward. I will address the reactors another time in a separate pull request. Thanks for the valid points, I understand the direction a lot better now! |
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.
Thank you!
@@ -153,6 +153,10 @@ async def start_blinking(self, hardware: HardwareControlAPI) -> None: | |||
Blinking will continue until `mark_hardware_init_complete()` and | |||
`mark_persistence_init_complete()` have both been called. | |||
""" | |||
if should_use_ot3(): | |||
# Dont run this task on the Flex |
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.
I think it would be worth elaborating in this comment why we want to take pains to avoid running this task on the Flex. And we probably want to correct my old comment below that wrongly says that it will no-op on the Flex. (It will raise an exception, not no-op, if there’s a firmware update in progress.)
Overview
The robot server crashes during initialization after doing firmware updates, this happens because we attempt to use the
FrontButtonBlinker.start_blinker
task in the Flex. The Opentrons/opentrons#6286 introduced this issue, it added the modernlifetime
concept to the FastAPI robot-server startup routine to perform better setup and teardowns. However, it also removedfbl_init
which checked if the robot was a Flex before instantiating theFrontButtonBlinkerLight
class. This pull request fixes this issue by adding a conditional that checks if we are on a Flex when instantiating theFrontButtonBlinkerLight
task.Closes: RQA-3302
Test Plan and Hands on Testing
Changelog
Review requests
Risk assessment
low