Skip to content

Commit

Permalink
Revert "Add SetTipUsedAction."
Browse files Browse the repository at this point in the history
This reverts commit b4d4d80.
  • Loading branch information
SyntaxColoring committed Apr 1, 2024
1 parent b4d4d80 commit b61913f
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 86 deletions.
2 changes: 0 additions & 2 deletions api/src/opentrons/protocol_engine/actions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
FinishErrorDetails,
DoorChangeAction,
ResetTipsAction,
SetTipUsedAction,
SetPipetteMovementSpeedAction,
)

Expand All @@ -52,7 +51,6 @@
"AddModuleAction",
"DoorChangeAction",
"ResetTipsAction",
"SetTipUsedAction",
"SetPipetteMovementSpeedAction",
# action payload values
"PauseSource",
Expand Down
11 changes: 1 addition & 10 deletions api/src/opentrons/protocol_engine/actions/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,19 +208,11 @@ class AddModuleAction:

@dataclass(frozen=True)
class ResetTipsAction:
"""See `ProtocolEngine.reset_tips()`."""
"""Reset the tip tracking state of a given tip rack."""

labware_id: str


@dataclass(frozen=True)
class SetTipUsedAction:
"""See `ProtocolEngine.set_tip_used()`."""

labware_id: str
well_name: str


@dataclass(frozen=True)
class SetPipetteMovementSpeedAction:
"""Set the speed of a pipette's X/Y/Z movements. Does not affect plunger speed.
Expand Down Expand Up @@ -250,6 +242,5 @@ class SetPipetteMovementSpeedAction:
AddAddressableAreaAction,
AddLiquidAction,
ResetTipsAction,
SetTipUsedAction,
SetPipetteMovementSpeedAction,
]
25 changes: 2 additions & 23 deletions api/src/opentrons/protocol_engine/protocol_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
from contextlib import AsyncExitStack
from logging import getLogger
from typing import Dict, Optional, Union
from opentrons.protocol_engine.actions.actions import (
ResumeFromRecoveryAction,
SetTipUsedAction,
)
from opentrons.protocol_engine.actions.actions import ResumeFromRecoveryAction
from opentrons.protocol_engine.error_recovery_policy import (
ErrorRecoveryPolicy,
ErrorRecoveryType,
Expand Down Expand Up @@ -540,29 +537,11 @@ def add_addressable_area(self, addressable_area_name: str) -> None:
)

def reset_tips(self, labware_id: str) -> None:
"""Reset the tip state of a given labware.
Protocol Engine does not directly use this for anything,
but it's helpful for calling code that's using Protocol Engine
to keep track of tips. See `state_view.tips`.
"""
"""Reset the tip state of a given labware."""
# TODO(mm, 2023-03-10): Safely raise an error if the given labware isn't a
# tip rack?
self._action_dispatcher.dispatch(ResetTipsAction(labware_id=labware_id))

def set_tip_used(self, labware_id: str, well_name: str) -> None:
"""Set a given tip as used (unavailable to be picked up).
Protocol Engine does not directly use this for anything,
but it's helpful for calling code that's using Protocol Engine
to keep track of tips. See `state_view.tips`.
"""
# TODO(mm, 2024-04-01): Safely raise an error if the labware ID or well name
# is bad?
self._action_dispatcher.dispatch(
SetTipUsedAction(labware_id=labware_id, well_name=well_name)
)

# TODO(mm, 2022-11-10): This is a method on ProtocolEngine instead of a command
# as a quick hack to support Python protocols. We should consider making this a
# command, or adding speed parameters to existing commands.
Expand Down
14 changes: 1 addition & 13 deletions api/src/opentrons/protocol_engine/state/tips.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
"""Tip state tracking.
This just a helper for the Python Protocol API. Protocol Engine does not directly use
this for anything, since all `pickUpTip` commands specify the tip location explicitly.
Higher-level code in the Python Protocol API chooses the tip. To do that, it needs to
keep track of tip state, and it's convenient to do that here, inside of
`opentrons.protocol_engine.state`, because we can hook into every `pickUpTip` command.
"""
"""Tip state tracking."""
from dataclasses import dataclass
from enum import Enum
from typing import Dict, Optional, List, Union
Expand All @@ -15,7 +8,6 @@
Action,
SucceedCommandAction,
ResetTipsAction,
SetTipUsedAction,
)
from ..commands import (
Command,
Expand Down Expand Up @@ -102,10 +94,6 @@ def handle_action(self, action: Action) -> None:
well_name
] = TipRackWellState.CLEAN

elif isinstance(action, SetTipUsedAction):
tip_state_by_well_name = self._state.tips_by_labware_id[action.labware_id]
tip_state_by_well_name[action.well_name] = TipRackWellState.USED

def _handle_command(self, command: Command) -> None:
if (
isinstance(command.result, LoadLabwareResult)
Expand Down
20 changes: 0 additions & 20 deletions api/tests/opentrons/protocol_engine/state/test_tip_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -703,26 +703,6 @@ def test_reset_tips(
assert result == "A1"


def test_set_tip_used(load_labware_command: commands.LoadLabware) -> None:
"""It should set the given tip as used so it's not picked up."""
subject = TipStore()
subject.handle_action(
actions.SucceedCommandAction(private_result=None, command=load_labware_command)
)
subject.handle_action(
actions.SetTipUsedAction(labware_id="cool-labware", well_name="A1")
)

result = TipView(subject.state).get_next_tip(
labware_id="cool-labware",
num_tips=1,
starting_tip_name=None,
nozzle_map=None,
)

assert result == "B1"


def test_handle_pipette_config_action(
subject: TipStore, supported_tip_fixture: pipette_definition.SupportedTipsDefinition
) -> None:
Expand Down
19 changes: 1 addition & 18 deletions api/tests/opentrons/protocol_engine/test_protocol_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@

from opentrons_shared_data.robot.dev_types import RobotType
from opentrons.ordered_set import OrderedSet
from opentrons.protocol_engine.actions.actions import (
ResumeFromRecoveryAction,
SetTipUsedAction,
)
from opentrons.protocol_engine.actions.actions import ResumeFromRecoveryAction
from opentrons.protocol_engine.error_recovery_policy import ErrorRecoveryType

from opentrons.types import DeckSlotName
Expand Down Expand Up @@ -1056,17 +1053,3 @@ def test_reset_tips(
action_dispatcher.dispatch(ResetTipsAction(labware_id="cool-labware")),
times=1,
)


def test_set_tip_used(
decoy: Decoy, action_dispatcher: ActionDispatcher, subject: ProtocolEngine
) -> None:
"""It should dispatch the equivalent action."""
subject.set_tip_used(labware_id="cool-labware", well_name="cool-well")

decoy.verify(
action_dispatcher.dispatch(
SetTipUsedAction(labware_id="cool-labware", well_name="cool-well")
),
times=1,
)

0 comments on commit b61913f

Please sign in to comment.