fix(api): Make labware loads and moves slightly more atomic #14846
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This tries to address one of the errors in RESC-227.
Suppose you tried to catch a labware load exception, like this:
When you catch the exception, the system is currently left in an inconsistent state. According to the Protocol Engine layer, the labware load succeeded. But according to the PAPI layer, the labware load failed. This is a longstanding known problem that has caused user-facing confusion before. In RESC-227, a customer tried to clear the slot by doing
del protocol.deck[slot]
, but the inconsistent state caused that to raise an internalKeyError
.Changelog
In
ProtocolContext.load_labware()
,ProtocolContext.load_adapter()
, andProtocolContext.move_labware()
: if we detect a conflict, try to keep the two layers in sync by "undoing" the load in Protocol Engine, by running a Protocol EnginemoveLabware
offDeck
command.This is not a real solution because:
ProtocolContext.load_module()
(because we can't unload modules).offDeck
labware move will show up in the run log.Review requests
Is this worth the complexity? Instead of doing this, should we push towards solving this the right way, as described in the
# todo
comment?opentrons/api/src/opentrons/protocol_api/core/engine/protocol.py
Lines 244 to 257 in 8cfa337
Test Plan
To do.
Risk assessment
To do.