-
Notifications
You must be signed in to change notification settings - Fork 180
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): Do not enter recovery mode if detect_liquid_presence()
detects no liquid
#15698
Conversation
Remove a check that always passes, guaranteed by the type checker.
Resolve conflicts in api/tests/opentrons/protocol_api/core/engine/test_instrument_core.py.
# The error handling here is a bit nuanced and also a bit broken: | ||
# | ||
# - If the hardware detects liquid, the `tryLiquidProbe` engine command will | ||
# succeed and return a height, which we'll convert to a `True` return. | ||
# Okay so far. | ||
# | ||
# - If the hardware detects no liquid, the `tryLiquidProbe` engine command will | ||
# suceced and return `None`, which we'll convert to a `False` return. | ||
# Still okay so far. | ||
# | ||
# - If there is any other error within the `tryLiquidProbe` command, things get | ||
# messy. It may kick the run into recovery mode. At that point, all bets are | ||
# off--we lose our guarantee of having a `tryLiquidProbe` command whose | ||
# `result` we can inspect. We don't know how to deal with that here, so we | ||
# currently propagate the exception up, which will quickly kill the protocol, | ||
# after a potential split second of recovery mode. It's unclear what would | ||
# be good user-facing behavior here, but it's unfortunate to kill the protocol | ||
# for an error that the engine thinks should be recoverable. |
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 third case, I believe, cannot happen in practice right now because our error recovery policy does not do error recovery for any tryLiquidProbe
failures . But who knows how long that will last.
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.
Is this unique to liquid probe? Wouldn't this be the case for any kind of command run from the protocol api via execute_command_without_recovery
? Or even executing a command that returns structured errors with execute_command_without_recovery
?
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.
It is not unique to liquid_probe()
, you're correct. It's any time PAPI uses execute_command_without_recovery()
, or, even more generally, any time PAPI has potentially different error-handling ideas than PE.
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, and I agree with the fundamentals of your comment - but is that really unique to liquid probe?
# The error handling here is a bit nuanced and also a bit broken: | ||
# | ||
# - If the hardware detects liquid, the `tryLiquidProbe` engine command will | ||
# succeed and return a height, which we'll convert to a `True` return. | ||
# Okay so far. | ||
# | ||
# - If the hardware detects no liquid, the `tryLiquidProbe` engine command will | ||
# suceced and return `None`, which we'll convert to a `False` return. | ||
# Still okay so far. | ||
# | ||
# - If there is any other error within the `tryLiquidProbe` command, things get | ||
# messy. It may kick the run into recovery mode. At that point, all bets are | ||
# off--we lose our guarantee of having a `tryLiquidProbe` command whose | ||
# `result` we can inspect. We don't know how to deal with that here, so we | ||
# currently propagate the exception up, which will quickly kill the protocol, | ||
# after a potential split second of recovery mode. It's unclear what would | ||
# be good user-facing behavior here, but it's unfortunate to kill the protocol | ||
# for an error that the engine thinks should be recoverable. |
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.
Is this unique to liquid probe? Wouldn't this be the case for any kind of command run from the protocol api via execute_command_without_recovery
? Or even executing a command that returns structured errors with execute_command_without_recovery
?
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! small typo fix
Co-authored-by: TamarZanzouri <[email protected]>
Failing tests look like a |
Overview
This closes EXEC-598.
Test plan
Run this protocol without any liquid:
detect_liquid_presence()
call should returnFalse
without entering recovery mode.require_liquid_presence()
call should enter recovery mode.Changelog
Reimplement
InstrumentContext.detect_liquid_presence()
atop the newtryLiquidProbe
command, implemented in #15667.Review requests
Any thoughts on my big comment in
api/src/opentrons/protocol_api/core/engine/instrument.py
? I think one of the "right" solutions in EXEC-598 would help. But even with that, it remains unclear to me how we want the overall system to behave when something like this happens:detect_liquid_presence()
result (True
/False
)Risk assessment
Low.