From ed46f6501e9cfae45fecb39f1a2faf512a9c194e Mon Sep 17 00:00:00 2001 From: Seth Foster Date: Wed, 24 Jul 2024 15:53:20 -0400 Subject: [PATCH] handle state correctly --- .../protocol_engine/state/pipettes.py | 5 +- .../state/test_pipette_store.py | 66 +++++++++++++++++++ 2 files changed, 69 insertions(+), 2 deletions(-) diff --git a/api/src/opentrons/protocol_engine/state/pipettes.py b/api/src/opentrons/protocol_engine/state/pipettes.py index 92344dd96000..35cfca94f331 100644 --- a/api/src/opentrons/protocol_engine/state/pipettes.py +++ b/api/src/opentrons/protocol_engine/state/pipettes.py @@ -13,6 +13,7 @@ ) from opentrons.protocol_engine.actions.actions import FailCommandAction from opentrons.protocol_engine.commands.aspirate import Aspirate +from opentrons.protocol_engine.commands.dispense import Dispense from opentrons.protocol_engine.commands.command import DefinedErrorData from opentrons.protocol_engine.commands.pipetting_common import ( OverpressureError, @@ -316,7 +317,7 @@ def _update_current_location( # noqa: C901 ) elif ( isinstance(action, FailCommandAction) - and isinstance(action.running_command, Aspirate) + and isinstance(action.running_command, (Aspirate, Dispense)) and isinstance(action.error, DefinedErrorData) and isinstance(action.error.public, OverpressureError) ): @@ -412,7 +413,7 @@ def _update_deck_point( ) elif ( isinstance(action, FailCommandAction) - and isinstance(action.running_command, Aspirate) + and isinstance(action.running_command, (Aspirate, Dispense)) and isinstance(action.error, DefinedErrorData) and isinstance(action.error.public, OverpressureError) ): diff --git a/api/tests/opentrons/protocol_engine/state/test_pipette_store.py b/api/tests/opentrons/protocol_engine/state/test_pipette_store.py index 8ccfc06fd074..c6d4bba3df89 100644 --- a/api/tests/opentrons/protocol_engine/state/test_pipette_store.py +++ b/api/tests/opentrons/protocol_engine/state/test_pipette_store.py @@ -425,6 +425,42 @@ def test_blow_out_clears_volume( well_name="move-to-well-well-name", ), ), + ( + FailCommandAction( + running_command=cmd.Dispense( + params=cmd.DispenseParams( + pipetteId="pipette-id", + labwareId="dispense-labware-id", + wellName="dispense-well-name", + volume=50, + flowRate=1.23, + ), + id="command-id", + key="command-key", + createdAt=datetime.now(), + status=cmd.CommandStatus.RUNNING, + ), + error=DefinedErrorData( + public=OverpressureError( + id="error-id", + createdAt=datetime.now(), + ), + private=OverpressureErrorInternalData( + position=DeckPoint(x=0, y=0, z=0) + ), + ), + command_id="command-id", + error_id="error-id", + failed_at=datetime.now(), + notes=[], + type=ErrorRecoveryType.WAIT_FOR_RECOVERY, + ), + CurrentWell( + pipette_id="pipette-id", + labware_id="dispense-labware-id", + well_name="dispense-well-name", + ), + ), ), ) def test_movement_commands_update_current_well( @@ -900,6 +936,36 @@ def test_add_pipette_config( ), private_result=None, ), + FailCommandAction( + running_command=cmd.Dispense( + params=cmd.DispenseParams( + pipetteId="pipette-id", + labwareId="labware-id", + wellName="well-name", + volume=125, + flowRate=1.23, + ), + id="command-id", + key="command-key", + createdAt=datetime.now(), + status=cmd.CommandStatus.RUNNING, + ), + error=DefinedErrorData( + public=OverpressureError( + id="error-id", + detail="error-detail", + createdAt=datetime.now(), + ), + private=OverpressureErrorInternalData( + position=DeckPoint(x=11, y=22, z=33) + ), + ), + command_id="command-id", + error_id="error-id", + failed_at=datetime.now(), + notes=[], + type=ErrorRecoveryType.WAIT_FOR_RECOVERY, + ), ), ) def test_movement_commands_update_deck_point(