Skip to content

Commit

Permalink
Revert "fix(api): allow loading a flex trash into column 3 only (#13304
Browse files Browse the repository at this point in the history
…)"

This reverts commit b63c78e.
  • Loading branch information
TamarZanzouri committed Aug 25, 2023
1 parent 6813f64 commit 355b0ab
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 63 deletions.
17 changes: 1 addition & 16 deletions api/src/opentrons/protocol_engine/commands/load_labware.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@

from opentrons_shared_data.labware.labware_definition import LabwareDefinition

from ..errors import LabwareIsNotAllowedInLocationError
from ..resources import labware_validation
from ..types import LabwareLocation, OnLabwareLocation, DeckSlotLocation

from ..types import LabwareLocation, OnLabwareLocation
from .command import AbstractCommandImpl, BaseCommand, BaseCommandCreate

if TYPE_CHECKING:
Expand Down Expand Up @@ -93,18 +90,6 @@ def __init__(

async def execute(self, params: LoadLabwareParams) -> LoadLabwareResult:
"""Load definition and calibration data necessary for a labware."""
# TODO (tz, 8-15-2023): extend column validation to column 1 when working
# on https://opentrons.atlassian.net/browse/RSS-258 and completing
# https://opentrons.atlassian.net/browse/RSS-255
if (
labware_validation.is_flex_trash(params.loadName)
and isinstance(params.location, DeckSlotLocation)
and self._state_view.geometry.get_slot_column(params.location.slotName) != 3
):
raise LabwareIsNotAllowedInLocationError(
f"{params.loadName} is not allowed in slot {params.location.slotName}"
)

loaded_labware = await self._equipment.load_labware(
load_name=params.loadName,
namespace=params.namespace,
Expand Down
2 changes: 0 additions & 2 deletions api/src/opentrons/protocol_engine/errors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
GripperNotAttachedError,
HardwareNotSupportedError,
LabwareMovementNotAllowedError,
LabwareIsNotAllowedInLocationError,
LocationIsOccupiedError,
InvalidAxisForRobotType,
NotSupportedOnRobotType,
Expand Down Expand Up @@ -110,7 +109,6 @@
"GripperNotAttachedError",
"HardwareNotSupportedError",
"LabwareMovementNotAllowedError",
"LabwareIsNotAllowedInLocationError",
"LocationIsOccupiedError",
"InvalidAxisForRobotType",
"NotSupportedOnRobotType",
Expand Down
13 changes: 0 additions & 13 deletions api/src/opentrons/protocol_engine/errors/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,19 +689,6 @@ def __init__(
super().__init__(ErrorCodes.GENERAL_ERROR, message, details, wrapping)


class LabwareIsNotAllowedInLocationError(ProtocolEngineError):
"""Raised when attempting an illegal labware load into slot."""

def __init__(
self,
message: Optional[str] = None,
details: Optional[Dict[str, Any]] = None,
wrapping: Optional[Sequence[EnumeratedError]] = None,
) -> None:
"""Build a LabwareIsNotAllowedInLocationError."""
super().__init__(ErrorCodes.GENERAL_ERROR, message, details, wrapping)


class LocationIsOccupiedError(ProtocolEngineError):
"""Raised when attempting to place labware in a non-empty location."""

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
from opentrons.protocols.models import LabwareDefinition


def is_flex_trash(load_name: str) -> bool:
"""Check if a labware is a large trash."""
return load_name == "opentrons_1_trash_3200ml_fixed"


def validate_definition_is_labware(definition: LabwareDefinition) -> bool:
"""Validate that one of the definition's allowed roles is `labware`.
Expand Down
27 changes: 0 additions & 27 deletions api/tests/opentrons/protocol_engine/commands/test_load_labware.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@

from opentrons.types import DeckSlotName
from opentrons.protocols.models import LabwareDefinition

from opentrons.protocol_engine.errors import (
LabwareIsNotAllowedInLocationError,
)

from opentrons.protocol_engine.types import (
DeckSlotLocation,
OnLabwareLocation,
Expand Down Expand Up @@ -81,28 +76,6 @@ async def test_load_labware_implementation(
)


async def test_load_labware_raises_location_not_allowed(
decoy: Decoy,
equipment: EquipmentHandler,
state_view: StateView,
) -> None:
"""A LoadLabware command should raise if the flex trash definition is not in a valid slot."""
subject = LoadLabwareImplementation(equipment=equipment, state_view=state_view)

data = LoadLabwareParams(
location=DeckSlotLocation(slotName=DeckSlotName.SLOT_A2),
loadName="some-load-name",
namespace="opentrons-test",
version=1,
displayName="My custom display name",
)

decoy.when(labware_validation.is_flex_trash("some-load-name")).then_return(True)

with pytest.raises(LabwareIsNotAllowedInLocationError):
await subject.execute(data)


async def test_load_labware_on_labware(
decoy: Decoy,
well_plate_def: LabwareDefinition,
Expand Down

0 comments on commit 355b0ab

Please sign in to comment.