Skip to content

Commit

Permalink
handle state correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
sfoster1 committed Jul 24, 2024
1 parent 0d754e2 commit ed46f65
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 2 deletions.
5 changes: 3 additions & 2 deletions api/src/opentrons/protocol_engine/state/pipettes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
):
Expand Down Expand Up @@ -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)
):
Expand Down
66 changes: 66 additions & 0 deletions api/tests/opentrons/protocol_engine/state/test_pipette_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit ed46f65

Please sign in to comment.