Skip to content

Commit bb5ad6a

Browse files
committed
home -> prepareShuttle
1 parent 2fbf636 commit bb5ad6a

File tree

5 files changed

+153
-139
lines changed

5 files changed

+153
-139
lines changed

api/src/opentrons/protocol_engine/commands/command_unions.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -482,7 +482,7 @@
482482
flex_stacker.SetStoredLabware,
483483
flex_stacker.Fill,
484484
flex_stacker.Empty,
485-
flex_stacker.Home,
485+
flex_stacker.PrepareShuttle,
486486
calibration.CalibrateGripper,
487487
calibration.CalibratePipette,
488488
calibration.CalibrateModule,
@@ -581,7 +581,7 @@
581581
flex_stacker.SetStoredLabwareParams,
582582
flex_stacker.FillParams,
583583
flex_stacker.EmptyParams,
584-
flex_stacker.HomeParams,
584+
flex_stacker.PrepareShuttleParams,
585585
calibration.CalibrateGripperParams,
586586
calibration.CalibratePipetteParams,
587587
calibration.CalibrateModuleParams,
@@ -678,7 +678,7 @@
678678
flex_stacker.SetStoredLabwareCommandType,
679679
flex_stacker.FillCommandType,
680680
flex_stacker.EmptyCommandType,
681-
flex_stacker.HomeCommandType,
681+
flex_stacker.PrepareShuttleCommandType,
682682
calibration.CalibrateGripperCommandType,
683683
calibration.CalibratePipetteCommandType,
684684
calibration.CalibrateModuleCommandType,
@@ -776,7 +776,7 @@
776776
flex_stacker.SetStoredLabwareCreate,
777777
flex_stacker.FillCreate,
778778
flex_stacker.EmptyCreate,
779-
flex_stacker.HomeCreate,
779+
flex_stacker.PrepareShuttleCreate,
780780
calibration.CalibrateGripperCreate,
781781
calibration.CalibratePipetteCreate,
782782
calibration.CalibrateModuleCreate,
@@ -882,7 +882,7 @@
882882
flex_stacker.SetStoredLabwareResult,
883883
flex_stacker.FillResult,
884884
flex_stacker.EmptyResult,
885-
flex_stacker.HomeResult,
885+
flex_stacker.PrepareShuttleResult,
886886
calibration.CalibrateGripperResult,
887887
calibration.CalibratePipetteResult,
888888
calibration.CalibrateModuleResult,

api/src/opentrons/protocol_engine/commands/flex_stacker/__init__.py

+13-7
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,13 @@
2929

3030
from .empty import EmptyCommandType, EmptyParams, EmptyResult, Empty, EmptyCreate
3131

32-
from .home import HomeCommandType, HomeParams, HomeResult, Home, HomeCreate
32+
from .prepare_shuttle import (
33+
PrepareShuttleCommandType,
34+
PrepareShuttleParams,
35+
PrepareShuttleResult,
36+
PrepareShuttle,
37+
PrepareShuttleCreate,
38+
)
3339

3440

3541
__all__ = [
@@ -64,10 +70,10 @@
6470
"EmptyResult",
6571
"Empty",
6672
"EmptyCreate",
67-
# flexStacker/home
68-
"HomeCommandType",
69-
"HomeParams",
70-
"HomeResult",
71-
"Home",
72-
"HomeCreate",
73+
# flexStacker/prepareShuttle
74+
"PrepareShuttleCommandType",
75+
"PrepareShuttleParams",
76+
"PrepareShuttleResult",
77+
"PrepareShuttle",
78+
"PrepareShuttleCreate",
7379
]

api/src/opentrons/protocol_engine/commands/flex_stacker/home.py api/src/opentrons/protocol_engine/commands/flex_stacker/prepare_shuttle.py

+28-24
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Command models to home the stacker."""
1+
"""Command models to prepare the stacker shuttle for movement."""
22

33
from __future__ import annotations
44

@@ -8,7 +8,7 @@
88

99
from pydantic import BaseModel, Field
1010

11-
from ..flex_stacker.common import FlexStackerStallOrCollisionError
11+
from .common import FlexStackerStallOrCollisionError
1212
from opentrons_shared_data.errors.exceptions import FlexStackerStallError
1313

1414
from ..command import (
@@ -25,26 +25,27 @@
2525
from ...state.state import StateView
2626
from ...execution import EquipmentHandler
2727

28-
HomeCommandType = Literal["flexStacker/home"]
28+
PrepareShuttleCommandType = Literal["flexStacker/prepareShuttle"]
2929

3030

31-
class HomeParams(BaseModel):
32-
"""The parameters defining how a stacker should be emptied."""
31+
class PrepareShuttleParams(BaseModel):
32+
"""The parameters for a PrepareShuttle command."""
3333

3434
moduleId: str = Field(..., description="Unique ID of the Flex Stacker")
3535

3636

37-
class HomeResult(BaseModel):
38-
"""Result data from a stacker empty command."""
37+
class PrepareShuttleResult(BaseModel):
38+
"""Result data from a stacker PrepareShuttle command."""
3939

4040

4141
_ExecuteReturn = Union[
42-
SuccessData[HomeResult], DefinedErrorData[FlexStackerStallOrCollisionError]
42+
SuccessData[PrepareShuttleResult],
43+
DefinedErrorData[FlexStackerStallOrCollisionError],
4344
]
4445

4546

46-
class HomeImpl(AbstractCommandImpl[HomeParams, _ExecuteReturn]):
47-
"""Implementation of a stacker empty command."""
47+
class PrepareShuttleImpl(AbstractCommandImpl[PrepareShuttleParams, _ExecuteReturn]):
48+
"""Implementation of a stacker prepare shuttle command."""
4849

4950
def __init__(
5051
self,
@@ -57,8 +58,8 @@ def __init__(
5758
self._equipment = equipment
5859
self._model_utils = model_utils
5960

60-
async def execute(self, params: HomeParams) -> _ExecuteReturn:
61-
"""Execute the stacker empty command."""
61+
async def execute(self, params: PrepareShuttleParams) -> _ExecuteReturn:
62+
"""Execute the stacker prepare shuttle command."""
6263
stacker_state = self._state_view.modules.get_flex_stacker_substate(
6364
params.moduleId
6465
)
@@ -82,24 +83,27 @@ async def execute(self, params: HomeParams) -> _ExecuteReturn:
8283
],
8384
),
8485
)
86+
# TODO we should also add a check for shuttle not detected error
8587

86-
return SuccessData(public=HomeResult())
88+
return SuccessData(public=PrepareShuttleResult())
8789

8890

89-
class Home(BaseCommand[HomeParams, HomeResult, ErrorOccurrence]):
90-
"""A command to home a Flex Stacker."""
91+
class PrepareShuttle(
92+
BaseCommand[PrepareShuttleParams, PrepareShuttleResult, ErrorOccurrence]
93+
):
94+
"""A command to prepare Flex Stacker shuttle."""
9195

92-
commandType: HomeCommandType = "flexStacker/home"
93-
params: HomeParams
94-
result: HomeResult | None = None
96+
commandType: PrepareShuttleCommandType = "flexStacker/prepareShuttle"
97+
params: PrepareShuttleParams
98+
result: PrepareShuttleResult | None = None
9599

96-
_ImplementationCls: Type[HomeImpl] = HomeImpl
100+
_ImplementationCls: Type[PrepareShuttleImpl] = PrepareShuttleImpl
97101

98102

99-
class HomeCreate(BaseCommandCreate[HomeParams]):
100-
"""A request to execute a Flex Stacker home command."""
103+
class PrepareShuttleCreate(BaseCommandCreate[PrepareShuttleParams]):
104+
"""A request to execute a Flex Stacker PrepareShuttle command."""
101105

102-
commandType: HomeCommandType = "flexStacker/home"
103-
params: HomeParams
106+
commandType: PrepareShuttleCommandType = "flexStacker/prepareShuttle"
107+
params: PrepareShuttleParams
104108

105-
_CommandCls: Type[Home] = Home
109+
_CommandCls: Type[PrepareShuttle] = PrepareShuttle

api/tests/opentrons/protocol_engine/commands/flex_stacker/test_home.py api/tests/opentrons/protocol_engine/commands/flex_stacker/test_prepare_shuttle.py

+14-10
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""Test Flex Stacker home command implementation."""
1+
"""Test Flex Stacker prepare shuttle command implementation."""
22

33
from datetime import datetime
44

@@ -19,29 +19,33 @@
1919
from opentrons.protocol_engine.execution import EquipmentHandler
2020
from opentrons.protocol_engine.commands import flex_stacker
2121
from opentrons.protocol_engine.commands.command import SuccessData, DefinedErrorData
22-
from opentrons.protocol_engine.commands.flex_stacker.home import HomeImpl
22+
from opentrons.protocol_engine.commands.flex_stacker.prepare_shuttle import (
23+
PrepareShuttleImpl,
24+
)
2325

2426
from opentrons_shared_data.errors.exceptions import FlexStackerStallError
2527

2628

2729
@pytest.fixture
2830
def subject(
2931
state_view: StateView, equipment: EquipmentHandler, model_utils: ModelUtils
30-
) -> HomeImpl:
31-
"""Get a home command to test."""
32-
return HomeImpl(state_view=state_view, equipment=equipment, model_utils=model_utils)
32+
) -> PrepareShuttleImpl:
33+
"""Get a PrepareShuttle command to test."""
34+
return PrepareShuttleImpl(
35+
state_view=state_view, equipment=equipment, model_utils=model_utils
36+
)
3337

3438

3539
async def test_home_command(
3640
decoy: Decoy,
3741
state_view: StateView,
3842
equipment: EquipmentHandler,
39-
subject: HomeImpl,
43+
subject: PrepareShuttleImpl,
4044
stacker_id: FlexStackerId,
4145
stacker_hardware: FlexStacker,
4246
) -> None:
4347
"""It should return a success data."""
44-
data = flex_stacker.HomeParams(moduleId=stacker_id)
48+
data = flex_stacker.PrepareShuttleParams(moduleId=stacker_id)
4549

4650
fs_module_substate = FlexStackerSubState(
4751
module_id=stacker_id,
@@ -59,14 +63,14 @@ async def test_home_command(
5963

6064
decoy.verify(await stacker_hardware.home_all(), times=1)
6165

62-
assert result == SuccessData(public=flex_stacker.HomeResult())
66+
assert result == SuccessData(public=flex_stacker.PrepareShuttleResult())
6367

6468

6569
async def test_home_command_with_stall_detected(
6670
decoy: Decoy,
6771
state_view: StateView,
6872
equipment: EquipmentHandler,
69-
subject: HomeImpl,
73+
subject: PrepareShuttleImpl,
7074
model_utils: ModelUtils,
7175
stacker_id: FlexStackerId,
7276
stacker_hardware: FlexStacker,
@@ -75,7 +79,7 @@ async def test_home_command_with_stall_detected(
7579
err_id = "error-id"
7680
err_timestamp = datetime(year=2025, month=3, day=19)
7781

78-
data = flex_stacker.HomeParams(moduleId=stacker_id)
82+
data = flex_stacker.PrepareShuttleParams(moduleId=stacker_id)
7983

8084
fs_module_substate = FlexStackerSubState(
8185
module_id=stacker_id,

0 commit comments

Comments
 (0)