opentrons 8.7.0a7__py3-none-any.whl → 8.7.0a8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of opentrons might be problematic. Click here for more details.
- opentrons/_version.py +2 -2
- opentrons/drivers/asyncio/communication/serial_connection.py +55 -129
- opentrons/drivers/flex_stacker/driver.py +6 -1
- opentrons/drivers/heater_shaker/abstract.py +0 -5
- opentrons/drivers/heater_shaker/driver.py +0 -10
- opentrons/drivers/heater_shaker/simulator.py +0 -4
- opentrons/drivers/thermocycler/abstract.py +0 -6
- opentrons/drivers/thermocycler/driver.py +10 -61
- opentrons/drivers/thermocycler/simulator.py +0 -6
- opentrons/hardware_control/api.py +5 -24
- opentrons/hardware_control/backends/controller.py +2 -8
- opentrons/hardware_control/backends/flex_protocol.py +1 -0
- opentrons/hardware_control/backends/ot3controller.py +3 -3
- opentrons/hardware_control/backends/ot3simulator.py +2 -2
- opentrons/hardware_control/backends/simulator.py +1 -2
- opentrons/hardware_control/backends/subsystem_manager.py +2 -5
- opentrons/hardware_control/emulation/abstract_emulator.py +4 -6
- opentrons/hardware_control/emulation/connection_handler.py +5 -8
- opentrons/hardware_control/emulation/heater_shaker.py +3 -12
- opentrons/hardware_control/emulation/settings.py +1 -1
- opentrons/hardware_control/emulation/thermocycler.py +15 -67
- opentrons/hardware_control/module_control.py +8 -82
- opentrons/hardware_control/modules/__init__.py +0 -3
- opentrons/hardware_control/modules/absorbance_reader.py +4 -11
- opentrons/hardware_control/modules/flex_stacker.py +9 -38
- opentrons/hardware_control/modules/heater_shaker.py +5 -42
- opentrons/hardware_control/modules/magdeck.py +4 -8
- opentrons/hardware_control/modules/mod_abc.py +5 -13
- opentrons/hardware_control/modules/tempdeck.py +5 -25
- opentrons/hardware_control/modules/thermocycler.py +11 -68
- opentrons/hardware_control/modules/types.py +1 -20
- opentrons/hardware_control/modules/utils.py +4 -11
- opentrons/hardware_control/nozzle_manager.py +0 -3
- opentrons/hardware_control/ot3api.py +7 -26
- opentrons/hardware_control/poller.py +8 -22
- opentrons/hardware_control/protocols/gripper_controller.py +1 -0
- opentrons/hardware_control/scripts/update_module_fw.py +0 -5
- opentrons/hardware_control/types.py +2 -31
- opentrons/legacy_commands/module_commands.py +0 -23
- opentrons/legacy_commands/protocol_commands.py +0 -20
- opentrons/legacy_commands/types.py +0 -80
- opentrons/motion_planning/deck_conflict.py +12 -17
- opentrons/motion_planning/waypoints.py +29 -15
- opentrons/protocol_api/__init__.py +1 -5
- opentrons/protocol_api/_types.py +1 -6
- opentrons/protocol_api/core/common.py +1 -3
- opentrons/protocol_api/core/engine/_default_labware_versions.py +11 -32
- opentrons/protocol_api/core/engine/labware.py +1 -8
- opentrons/protocol_api/core/engine/module_core.py +8 -75
- opentrons/protocol_api/core/engine/protocol.py +1 -18
- opentrons/protocol_api/core/engine/well.py +0 -8
- opentrons/protocol_api/core/legacy/legacy_module_core.py +4 -24
- opentrons/protocol_api/core/legacy/legacy_protocol_core.py +1 -11
- opentrons/protocol_api/core/legacy/legacy_well_core.py +0 -4
- opentrons/protocol_api/core/legacy_simulator/legacy_protocol_core.py +2 -14
- opentrons/protocol_api/core/module.py +4 -37
- opentrons/protocol_api/core/protocol.py +2 -11
- opentrons/protocol_api/core/well.py +0 -4
- opentrons/protocol_api/labware.py +0 -5
- opentrons/protocol_api/module_contexts.py +11 -117
- opentrons/protocol_api/protocol_context.py +4 -26
- opentrons/protocol_api/robot_context.py +21 -38
- opentrons/protocol_api/validation.py +1 -6
- opentrons/protocol_engine/actions/__init__.py +2 -4
- opentrons/protocol_engine/actions/actions.py +9 -22
- opentrons/protocol_engine/clients/sync_client.py +7 -42
- opentrons/protocol_engine/commands/__init__.py +0 -42
- opentrons/protocol_engine/commands/absorbance_reader/close_lid.py +15 -2
- opentrons/protocol_engine/commands/absorbance_reader/open_lid.py +15 -2
- opentrons/protocol_engine/commands/aspirate.py +0 -1
- opentrons/protocol_engine/commands/command.py +0 -1
- opentrons/protocol_engine/commands/command_unions.py +0 -49
- opentrons/protocol_engine/commands/dispense.py +0 -1
- opentrons/protocol_engine/commands/drop_tip.py +8 -32
- opentrons/protocol_engine/commands/heater_shaker/__init__.py +0 -14
- opentrons/protocol_engine/commands/heater_shaker/set_and_wait_for_shake_speed.py +4 -5
- opentrons/protocol_engine/commands/heater_shaker/set_target_temperature.py +5 -31
- opentrons/protocol_engine/commands/movement_common.py +0 -2
- opentrons/protocol_engine/commands/pick_up_tip.py +11 -21
- opentrons/protocol_engine/commands/temperature_module/set_target_temperature.py +7 -38
- opentrons/protocol_engine/commands/thermocycler/__init__.py +0 -16
- opentrons/protocol_engine/commands/thermocycler/run_extended_profile.py +0 -6
- opentrons/protocol_engine/commands/thermocycler/run_profile.py +0 -8
- opentrons/protocol_engine/commands/thermocycler/set_target_block_temperature.py +6 -40
- opentrons/protocol_engine/commands/thermocycler/set_target_lid_temperature.py +5 -29
- opentrons/protocol_engine/commands/touch_tip.py +1 -1
- opentrons/protocol_engine/commands/unsafe/unsafe_place_labware.py +22 -6
- opentrons/protocol_engine/errors/__init__.py +0 -4
- opentrons/protocol_engine/errors/exceptions.py +0 -55
- opentrons/protocol_engine/execution/__init__.py +0 -2
- opentrons/protocol_engine/execution/command_executor.py +0 -8
- opentrons/protocol_engine/execution/create_queue_worker.py +1 -5
- opentrons/protocol_engine/execution/labware_movement.py +21 -10
- opentrons/protocol_engine/execution/movement.py +0 -2
- opentrons/protocol_engine/execution/queue_worker.py +0 -4
- opentrons/protocol_engine/execution/run_control.py +0 -8
- opentrons/protocol_engine/protocol_engine.py +34 -75
- opentrons/protocol_engine/resources/__init__.py +0 -2
- opentrons/protocol_engine/resources/deck_configuration_provider.py +0 -7
- opentrons/protocol_engine/resources/labware_validation.py +6 -10
- opentrons/protocol_engine/state/_labware_origin_math.py +636 -0
- opentrons/protocol_engine/state/_well_math.py +18 -60
- opentrons/protocol_engine/state/addressable_areas.py +0 -2
- opentrons/protocol_engine/state/commands.py +11 -14
- opentrons/protocol_engine/state/geometry.py +374 -213
- opentrons/protocol_engine/state/labware.py +102 -52
- opentrons/protocol_engine/state/module_substates/thermocycler_module_substate.py +0 -37
- opentrons/protocol_engine/state/modules.py +8 -21
- opentrons/protocol_engine/state/motion.py +0 -44
- opentrons/protocol_engine/state/state.py +0 -14
- opentrons/protocol_engine/state/state_summary.py +0 -2
- opentrons/protocol_engine/state/tips.py +258 -177
- opentrons/protocol_engine/state/update_types.py +9 -16
- opentrons/protocol_engine/types/__init__.py +3 -9
- opentrons/protocol_engine/types/deck_configuration.py +1 -5
- opentrons/protocol_engine/types/instrument.py +1 -8
- opentrons/protocol_engine/types/labware.py +13 -1
- opentrons/protocol_engine/types/module.py +0 -10
- opentrons/protocol_engine/types/tip.py +0 -9
- opentrons/protocol_runner/create_simulating_orchestrator.py +2 -29
- opentrons/protocol_runner/run_orchestrator.py +2 -18
- opentrons/protocols/api_support/definitions.py +1 -1
- opentrons/protocols/api_support/types.py +1 -2
- opentrons/simulate.py +15 -48
- opentrons/system/camera.py +1 -1
- {opentrons-8.7.0a7.dist-info → opentrons-8.7.0a8.dist-info}/METADATA +4 -4
- {opentrons-8.7.0a7.dist-info → opentrons-8.7.0a8.dist-info}/RECORD +130 -146
- opentrons/protocol_api/core/engine/tasks.py +0 -48
- opentrons/protocol_api/core/legacy/tasks.py +0 -19
- opentrons/protocol_api/core/legacy_simulator/tasks.py +0 -19
- opentrons/protocol_api/core/tasks.py +0 -31
- opentrons/protocol_api/tasks.py +0 -48
- opentrons/protocol_engine/commands/create_timer.py +0 -83
- opentrons/protocol_engine/commands/heater_shaker/common.py +0 -20
- opentrons/protocol_engine/commands/heater_shaker/set_shake_speed.py +0 -136
- opentrons/protocol_engine/commands/set_tip_state.py +0 -97
- opentrons/protocol_engine/commands/thermocycler/start_run_extended_profile.py +0 -191
- opentrons/protocol_engine/commands/wait_for_tasks.py +0 -98
- opentrons/protocol_engine/execution/task_handler.py +0 -157
- opentrons/protocol_engine/resources/concurrency_provider.py +0 -27
- opentrons/protocol_engine/state/labware_origin_math/errors.py +0 -94
- opentrons/protocol_engine/state/labware_origin_math/stackup_origin_to_labware_origin.py +0 -1331
- opentrons/protocol_engine/state/tasks.py +0 -139
- opentrons/protocol_engine/types/tasks.py +0 -38
- {opentrons-8.7.0a7.dist-info → opentrons-8.7.0a8.dist-info}/WHEEL +0 -0
- {opentrons-8.7.0a7.dist-info → opentrons-8.7.0a8.dist-info}/entry_points.txt +0 -0
- {opentrons-8.7.0a7.dist-info → opentrons-8.7.0a8.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
from datetime import datetime
|
|
2
|
-
from ..tasks import AbstractTaskCore
|
|
3
|
-
from opentrons.protocol_engine.clients import SyncClient as ProtocolEngineClient
|
|
4
|
-
from opentrons.protocol_engine.errors.exceptions import NoTaskFoundError
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class EngineTaskCore(AbstractTaskCore):
|
|
8
|
-
def __init__(
|
|
9
|
-
self, task_id: str | None, engine_client: ProtocolEngineClient
|
|
10
|
-
) -> None:
|
|
11
|
-
self._id = task_id
|
|
12
|
-
self._engine_client = engine_client
|
|
13
|
-
|
|
14
|
-
def get_created_at_timestamp(self) -> datetime:
|
|
15
|
-
if self._id is None:
|
|
16
|
-
raise NoTaskFoundError
|
|
17
|
-
try:
|
|
18
|
-
task = self._engine_client.state.tasks.get(self._id)
|
|
19
|
-
return task.createdAt
|
|
20
|
-
except NoTaskFoundError:
|
|
21
|
-
raise NoTaskFoundError
|
|
22
|
-
|
|
23
|
-
def is_done(self) -> bool:
|
|
24
|
-
if self._id is None:
|
|
25
|
-
raise NoTaskFoundError
|
|
26
|
-
try:
|
|
27
|
-
self._engine_client.state.tasks.get_finished(self._id)
|
|
28
|
-
return True
|
|
29
|
-
except NoTaskFoundError:
|
|
30
|
-
return False
|
|
31
|
-
|
|
32
|
-
def is_started(self) -> bool:
|
|
33
|
-
if self._id is None:
|
|
34
|
-
raise NoTaskFoundError
|
|
35
|
-
try:
|
|
36
|
-
self._engine_client.state.tasks.get_current(self._id)
|
|
37
|
-
return True
|
|
38
|
-
except NoTaskFoundError:
|
|
39
|
-
return self.is_done()
|
|
40
|
-
|
|
41
|
-
def get_finished_at_timestamp(self) -> datetime | None:
|
|
42
|
-
if self._id is None:
|
|
43
|
-
raise NoTaskFoundError
|
|
44
|
-
try:
|
|
45
|
-
finished_task = self._engine_client.state.tasks.get_finished(self._id)
|
|
46
|
-
return finished_task.finishedAt
|
|
47
|
-
except NoTaskFoundError:
|
|
48
|
-
return None
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
from ..tasks import AbstractTaskCore
|
|
2
|
-
from datetime import datetime
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
class LegacyTaskCore(AbstractTaskCore):
|
|
6
|
-
def __init__(self) -> None:
|
|
7
|
-
pass
|
|
8
|
-
|
|
9
|
-
def get_created_at_timestamp(self) -> datetime:
|
|
10
|
-
raise NotImplementedError("Legacy protocols do not implement tasks.")
|
|
11
|
-
|
|
12
|
-
def is_done(self) -> bool:
|
|
13
|
-
raise NotImplementedError("Legacy protocols do not implement tasks.")
|
|
14
|
-
|
|
15
|
-
def is_started(self) -> bool:
|
|
16
|
-
raise NotImplementedError("Legacy protocols do not implement tasks.")
|
|
17
|
-
|
|
18
|
-
def get_finished_at_timestamp(self) -> datetime | None:
|
|
19
|
-
raise NotImplementedError("Legacy protocols do not implement tasks.")
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
from ..tasks import AbstractTaskCore
|
|
2
|
-
from datetime import datetime
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
class LegacyTaskCore(AbstractTaskCore):
|
|
6
|
-
def __init__(self, created_at: datetime) -> None:
|
|
7
|
-
raise NotImplementedError("Legacy protocols do not implement tasks.")
|
|
8
|
-
|
|
9
|
-
def get_created_at_timestamp(self) -> datetime:
|
|
10
|
-
raise NotImplementedError("Legacy protocols do not implement tasks.")
|
|
11
|
-
|
|
12
|
-
def is_done(self) -> bool:
|
|
13
|
-
raise NotImplementedError("Legacy protocols do not implement tasks.")
|
|
14
|
-
|
|
15
|
-
def is_started(self) -> bool:
|
|
16
|
-
raise NotImplementedError("Legacy protocols do not implement tasks.")
|
|
17
|
-
|
|
18
|
-
def get_finished_at_timestamp(self) -> datetime | None:
|
|
19
|
-
raise NotImplementedError("Legacy protocols do not implement tasks.")
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
from abc import abstractmethod, ABC
|
|
2
|
-
from datetime import datetime
|
|
3
|
-
from typing import TypeVar
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class AbstractTaskCore(ABC):
|
|
7
|
-
@abstractmethod
|
|
8
|
-
def get_created_at_timestamp(self) -> datetime:
|
|
9
|
-
"""Get the createdAt timestamp of the task."""
|
|
10
|
-
...
|
|
11
|
-
|
|
12
|
-
@abstractmethod
|
|
13
|
-
def is_done(self) -> bool:
|
|
14
|
-
"""Returns ``True`` if the task is done."""
|
|
15
|
-
...
|
|
16
|
-
|
|
17
|
-
@abstractmethod
|
|
18
|
-
def is_started(self) -> bool:
|
|
19
|
-
"""Returns ``True`` if the task has started."""
|
|
20
|
-
...
|
|
21
|
-
|
|
22
|
-
@abstractmethod
|
|
23
|
-
def get_finished_at_timestamp(self) -> datetime | None:
|
|
24
|
-
"""The timestamp of the when the task finished.
|
|
25
|
-
|
|
26
|
-
Returns ``None`` if the task hasn't finished yet.
|
|
27
|
-
"""
|
|
28
|
-
...
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
TaskCoreType = TypeVar("TaskCoreType", bound=AbstractTaskCore)
|
opentrons/protocol_api/tasks.py
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"""Data for concurrent protocol tasks."""
|
|
2
|
-
from typing import TYPE_CHECKING
|
|
3
|
-
from datetime import datetime
|
|
4
|
-
from opentrons.protocols.api_support.util import requires_version
|
|
5
|
-
from opentrons.protocols.api_support.types import APIVersion
|
|
6
|
-
|
|
7
|
-
if TYPE_CHECKING:
|
|
8
|
-
from .core.common import TaskCore
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class Task:
|
|
12
|
-
"""A concurrent protocol task created by a protocol API function.
|
|
13
|
-
|
|
14
|
-
.. versionadded:: 2.27
|
|
15
|
-
"""
|
|
16
|
-
|
|
17
|
-
def __init__(self, core: "TaskCore", api_version: APIVersion) -> None:
|
|
18
|
-
"""Initialize a Task."""
|
|
19
|
-
self._core = core
|
|
20
|
-
self._api_version = api_version
|
|
21
|
-
|
|
22
|
-
@property
|
|
23
|
-
@requires_version(2, 27)
|
|
24
|
-
def created_at(self) -> datetime:
|
|
25
|
-
"""The timestamp of when the task was created."""
|
|
26
|
-
return self._core.get_created_at_timestamp()
|
|
27
|
-
|
|
28
|
-
@property
|
|
29
|
-
@requires_version(2, 27)
|
|
30
|
-
def done(self) -> bool:
|
|
31
|
-
"""Returns ``True`` if the task is done."""
|
|
32
|
-
return self._core.is_done()
|
|
33
|
-
|
|
34
|
-
@property
|
|
35
|
-
@requires_version(2, 27)
|
|
36
|
-
def started(self) -> bool:
|
|
37
|
-
"""Returns ``True`` if the task has started."""
|
|
38
|
-
return self._core.is_started()
|
|
39
|
-
...
|
|
40
|
-
|
|
41
|
-
@property
|
|
42
|
-
@requires_version(2, 27)
|
|
43
|
-
def finished_at(self) -> datetime | None:
|
|
44
|
-
"""The timestamp of the when the task finished.
|
|
45
|
-
|
|
46
|
-
Returns ``None`` if the task hasn't finished yet.
|
|
47
|
-
"""
|
|
48
|
-
return self._core.get_finished_at_timestamp()
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
"""CreateTimer command request, result, and implementation models."""
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
from pydantic import BaseModel, Field
|
|
5
|
-
from typing import Optional, Type, TYPE_CHECKING
|
|
6
|
-
from typing_extensions import Literal
|
|
7
|
-
|
|
8
|
-
from .command import AbstractCommandImpl, BaseCommand, BaseCommandCreate, SuccessData
|
|
9
|
-
from ..errors.error_occurrence import ErrorOccurrence
|
|
10
|
-
|
|
11
|
-
if TYPE_CHECKING:
|
|
12
|
-
from ..execution import TaskHandler, RunControlHandler
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
CreateTimerCommandType = Literal["createTimer"]
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
class CreateTimerParams(BaseModel):
|
|
19
|
-
"""Payload required to annotate execution with a CreateTimer."""
|
|
20
|
-
|
|
21
|
-
time: float = Field(
|
|
22
|
-
...,
|
|
23
|
-
description="The time before the timer should elapse in seconds. This is the minimum time before the timer elapses; it may in practice take longer than this.",
|
|
24
|
-
)
|
|
25
|
-
task_id: str | None = Field(
|
|
26
|
-
None,
|
|
27
|
-
description="The id of the timer task",
|
|
28
|
-
)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
class CreateTimerResult(BaseModel):
|
|
32
|
-
"""Result data from the execution of a CreateTimer command."""
|
|
33
|
-
|
|
34
|
-
task_id: str = Field(..., description="The id of the timer task")
|
|
35
|
-
time: float = Field(..., description="The same time as the parameter.")
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
class CreateTimerImplementation(
|
|
39
|
-
AbstractCommandImpl[CreateTimerParams, SuccessData[CreateTimerResult]]
|
|
40
|
-
):
|
|
41
|
-
"""CreateTimer command implementation."""
|
|
42
|
-
|
|
43
|
-
def __init__(
|
|
44
|
-
self,
|
|
45
|
-
task_handler: TaskHandler,
|
|
46
|
-
run_control: RunControlHandler,
|
|
47
|
-
**kwargs: object,
|
|
48
|
-
) -> None:
|
|
49
|
-
self._task_handler = task_handler
|
|
50
|
-
self._run_control = run_control
|
|
51
|
-
|
|
52
|
-
async def execute(
|
|
53
|
-
self, params: CreateTimerParams
|
|
54
|
-
) -> SuccessData[CreateTimerResult]:
|
|
55
|
-
"""No operation taken other than capturing message in command."""
|
|
56
|
-
|
|
57
|
-
async def timer(task_handler: TaskHandler) -> None:
|
|
58
|
-
async with task_handler.synchronize_concurrent("createTimer"):
|
|
59
|
-
await self._run_control.wait_for_duration(params.time)
|
|
60
|
-
|
|
61
|
-
task = await self._task_handler.create_task(timer, params.task_id)
|
|
62
|
-
return SuccessData(
|
|
63
|
-
public=CreateTimerResult(task_id=task.id, time=params.time),
|
|
64
|
-
)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
class CreateTimer(BaseCommand[CreateTimerParams, CreateTimerResult, ErrorOccurrence]):
|
|
68
|
-
"""CreateTimer command model."""
|
|
69
|
-
|
|
70
|
-
commandType: CreateTimerCommandType = "createTimer"
|
|
71
|
-
params: CreateTimerParams
|
|
72
|
-
result: Optional[CreateTimerResult] = None
|
|
73
|
-
|
|
74
|
-
_ImplementationCls: Type[CreateTimerImplementation] = CreateTimerImplementation
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
class CreateTimerCreate(BaseCommandCreate[CreateTimerParams]):
|
|
78
|
-
"""CreateTimer command request model."""
|
|
79
|
-
|
|
80
|
-
commandType: CreateTimerCommandType = "createTimer"
|
|
81
|
-
params: CreateTimerParams
|
|
82
|
-
|
|
83
|
-
_CommandCls: Type[CreateTimer] = CreateTimer
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"""Common heatershaker base models."""
|
|
2
|
-
from opentrons.protocol_engine.state.module_substates.heater_shaker_module_substate import (
|
|
3
|
-
HeaterShakerModuleSubState,
|
|
4
|
-
)
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
async def get_heatershaker_ready_to_shake(
|
|
8
|
-
hs_module_substate: HeaterShakerModuleSubState,
|
|
9
|
-
rpm: float,
|
|
10
|
-
) -> int:
|
|
11
|
-
"""Check heatershaker state to confirm if it is ready to shake.
|
|
12
|
-
|
|
13
|
-
This includes
|
|
14
|
-
- Checking latch closure
|
|
15
|
-
- Validating target speed
|
|
16
|
-
"""
|
|
17
|
-
hs_module_substate.raise_if_labware_latch_not_closed()
|
|
18
|
-
# Verify speed from hs module view
|
|
19
|
-
validated_speed = hs_module_substate.validate_target_speed(rpm)
|
|
20
|
-
return validated_speed
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
"""Command models to set a shake speed for a Heater-Shaker Module."""
|
|
2
|
-
from __future__ import annotations
|
|
3
|
-
from typing import Optional, TYPE_CHECKING
|
|
4
|
-
from typing_extensions import Literal, Type
|
|
5
|
-
from pydantic import BaseModel, Field
|
|
6
|
-
|
|
7
|
-
from ..command import AbstractCommandImpl, BaseCommand, BaseCommandCreate, SuccessData
|
|
8
|
-
from ...errors.error_occurrence import ErrorOccurrence
|
|
9
|
-
from ...state import update_types
|
|
10
|
-
from .common import get_heatershaker_ready_to_shake
|
|
11
|
-
|
|
12
|
-
if TYPE_CHECKING:
|
|
13
|
-
from opentrons.protocol_engine.state.state import StateView
|
|
14
|
-
from opentrons.protocol_engine.execution import (
|
|
15
|
-
EquipmentHandler,
|
|
16
|
-
MovementHandler,
|
|
17
|
-
TaskHandler,
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
SetShakeSpeedCommandType = Literal["heaterShaker/setShakeSpeed"]
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
class SetShakeSpeedParams(BaseModel):
|
|
24
|
-
"""Input parameters to set a shake speed for a Heater-Shaker Module."""
|
|
25
|
-
|
|
26
|
-
moduleId: str = Field(..., description="Unique ID of the Heater-Shaker Module.")
|
|
27
|
-
rpm: float = Field(..., description="Target speed in rotations per minute.")
|
|
28
|
-
taskId: str | None = Field(
|
|
29
|
-
None,
|
|
30
|
-
description="Id for the background task that manages the temperature",
|
|
31
|
-
)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
class SetShakeSpeedResult(BaseModel):
|
|
35
|
-
"""Result data from setting and waiting for a Heater-Shaker's shake speed."""
|
|
36
|
-
|
|
37
|
-
pipetteRetracted: bool = Field(
|
|
38
|
-
...,
|
|
39
|
-
description=(
|
|
40
|
-
"Whether this command automatically retracted the pipettes"
|
|
41
|
-
" before starting the shake, to avoid a potential collision."
|
|
42
|
-
),
|
|
43
|
-
)
|
|
44
|
-
taskId: str = Field(
|
|
45
|
-
description="The task id for the setTargetTemperature task",
|
|
46
|
-
)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
class SetShakeSpeedImpl(
|
|
50
|
-
AbstractCommandImpl[SetShakeSpeedParams, SuccessData[SetShakeSpeedResult]]
|
|
51
|
-
):
|
|
52
|
-
"""Execution implementation of Heater-Shaker's set shake speed command."""
|
|
53
|
-
|
|
54
|
-
def __init__(
|
|
55
|
-
self,
|
|
56
|
-
state_view: StateView,
|
|
57
|
-
equipment: EquipmentHandler,
|
|
58
|
-
movement: MovementHandler,
|
|
59
|
-
task_handler: TaskHandler,
|
|
60
|
-
**unused_dependencies: object,
|
|
61
|
-
) -> None:
|
|
62
|
-
self._state_view = state_view
|
|
63
|
-
self._equipment = equipment
|
|
64
|
-
self._movement = movement
|
|
65
|
-
self._task_handler = task_handler
|
|
66
|
-
|
|
67
|
-
async def execute(
|
|
68
|
-
self,
|
|
69
|
-
params: SetShakeSpeedParams,
|
|
70
|
-
) -> SuccessData[SetShakeSpeedResult]:
|
|
71
|
-
"""Set a Heater-Shaker's target shake speed."""
|
|
72
|
-
state_update = update_types.StateUpdate()
|
|
73
|
-
|
|
74
|
-
# Allow propagation of ModuleNotLoadedError and WrongModuleTypeError.
|
|
75
|
-
hs_module_substate = self._state_view.modules.get_heater_shaker_module_substate(
|
|
76
|
-
module_id=params.moduleId
|
|
77
|
-
)
|
|
78
|
-
|
|
79
|
-
validated_speed = await get_heatershaker_ready_to_shake(
|
|
80
|
-
hs_module_substate, params.rpm
|
|
81
|
-
)
|
|
82
|
-
pipette_should_retract = (
|
|
83
|
-
self._state_view.motion.check_pipette_blocking_hs_shaker(
|
|
84
|
-
hs_module_substate.module_id
|
|
85
|
-
)
|
|
86
|
-
)
|
|
87
|
-
if pipette_should_retract:
|
|
88
|
-
# Move pipette away if it is close to the heater-shaker
|
|
89
|
-
# TODO(jbl 2022-07-28) replace home movement with a retract movement
|
|
90
|
-
await self._movement.home(
|
|
91
|
-
axes=self._state_view.motion.get_robot_mount_axes()
|
|
92
|
-
)
|
|
93
|
-
state_update.clear_all_pipette_locations()
|
|
94
|
-
|
|
95
|
-
# Allow propagation of ModuleNotAttachedError.
|
|
96
|
-
hs_hardware_module = self._equipment.get_module_hardware_api(
|
|
97
|
-
hs_module_substate.module_id
|
|
98
|
-
)
|
|
99
|
-
|
|
100
|
-
async def start_shake(task_handler: TaskHandler) -> None:
|
|
101
|
-
if hs_hardware_module is not None:
|
|
102
|
-
async with task_handler.synchronize_cancel_previous(
|
|
103
|
-
hs_module_substate.module_id
|
|
104
|
-
):
|
|
105
|
-
await hs_hardware_module.set_speed(rpm=validated_speed)
|
|
106
|
-
|
|
107
|
-
task = await self._task_handler.create_task(
|
|
108
|
-
task_function=start_shake, id=params.taskId
|
|
109
|
-
)
|
|
110
|
-
return SuccessData(
|
|
111
|
-
public=SetShakeSpeedResult(
|
|
112
|
-
pipetteRetracted=pipette_should_retract, taskId=task.id
|
|
113
|
-
),
|
|
114
|
-
state_update=state_update,
|
|
115
|
-
)
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
class SetShakeSpeed(
|
|
119
|
-
BaseCommand[SetShakeSpeedParams, SetShakeSpeedResult, ErrorOccurrence]
|
|
120
|
-
):
|
|
121
|
-
"""A command to set a Heater-Shaker's shake speed."""
|
|
122
|
-
|
|
123
|
-
commandType: SetShakeSpeedCommandType = "heaterShaker/setShakeSpeed"
|
|
124
|
-
params: SetShakeSpeedParams
|
|
125
|
-
result: Optional[SetShakeSpeedResult] = None
|
|
126
|
-
|
|
127
|
-
_ImplementationCls: Type[SetShakeSpeedImpl] = SetShakeSpeedImpl
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
class SetShakeSpeedCreate(BaseCommandCreate[SetShakeSpeedParams]):
|
|
131
|
-
"""A request to create a Heater-Shaker's set shake speed command."""
|
|
132
|
-
|
|
133
|
-
commandType: SetShakeSpeedCommandType = "heaterShaker/setShakeSpeed"
|
|
134
|
-
params: SetShakeSpeedParams
|
|
135
|
-
|
|
136
|
-
_CommandCls: Type[SetShakeSpeed] = SetShakeSpeed
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
"""Set tip state command request, result, and implementation models."""
|
|
2
|
-
|
|
3
|
-
from __future__ import annotations
|
|
4
|
-
from pydantic import BaseModel, Field
|
|
5
|
-
from typing import TYPE_CHECKING, Optional, Type, List
|
|
6
|
-
from typing_extensions import Literal
|
|
7
|
-
|
|
8
|
-
from ..errors.error_occurrence import ErrorOccurrence
|
|
9
|
-
from ..state.update_types import StateUpdate
|
|
10
|
-
from ..types import TipRackWellState
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
from .command import (
|
|
14
|
-
AbstractCommandImpl,
|
|
15
|
-
BaseCommand,
|
|
16
|
-
BaseCommandCreate,
|
|
17
|
-
SuccessData,
|
|
18
|
-
)
|
|
19
|
-
|
|
20
|
-
if TYPE_CHECKING:
|
|
21
|
-
from ..state.state import StateView
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
SetTipStateCommandType = Literal["setTipState"]
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
class SetTipStateParams(BaseModel):
|
|
28
|
-
"""Payload needed to set tip wells of a tip rack to the requested state."""
|
|
29
|
-
|
|
30
|
-
labwareId: str = Field(
|
|
31
|
-
..., description="Identifier of tip rack labware to set tip wells in."
|
|
32
|
-
)
|
|
33
|
-
wellNames: List[str] = Field(
|
|
34
|
-
..., description="Names of the well to set tip well state for."
|
|
35
|
-
)
|
|
36
|
-
tipWellState: TipRackWellState = Field(
|
|
37
|
-
..., description="State to set tip wells to."
|
|
38
|
-
)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
class SetTipStateResult(BaseModel):
|
|
42
|
-
"""Result data from the execution of a setTipState command."""
|
|
43
|
-
|
|
44
|
-
pass
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
class SetTipStateImplementation(
|
|
48
|
-
AbstractCommandImpl[SetTipStateParams, SuccessData[SetTipStateResult]]
|
|
49
|
-
):
|
|
50
|
-
"""Set tip state command implementation."""
|
|
51
|
-
|
|
52
|
-
def __init__(
|
|
53
|
-
self,
|
|
54
|
-
state_view: StateView,
|
|
55
|
-
**kwargs: object,
|
|
56
|
-
) -> None:
|
|
57
|
-
self._state_view = state_view
|
|
58
|
-
|
|
59
|
-
async def execute(
|
|
60
|
-
self, params: SetTipStateParams
|
|
61
|
-
) -> SuccessData[SetTipStateResult]:
|
|
62
|
-
"""Set the tip rack wells to the requested state."""
|
|
63
|
-
labware_id = params.labwareId
|
|
64
|
-
well_names = params.wellNames
|
|
65
|
-
|
|
66
|
-
self._state_view.labware.raise_if_not_tip_rack(labware_id=labware_id)
|
|
67
|
-
self._state_view.labware.raise_if_wells_are_invalid(
|
|
68
|
-
labware_id=labware_id, well_names=well_names
|
|
69
|
-
)
|
|
70
|
-
|
|
71
|
-
return SuccessData(
|
|
72
|
-
public=SetTipStateResult(),
|
|
73
|
-
state_update=StateUpdate().update_tip_rack_well_state(
|
|
74
|
-
tip_state=params.tipWellState,
|
|
75
|
-
labware_id=labware_id,
|
|
76
|
-
well_names=well_names,
|
|
77
|
-
),
|
|
78
|
-
)
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
class SetTipState(BaseCommand[SetTipStateParams, SetTipStateResult, ErrorOccurrence]):
|
|
82
|
-
"""Set tip state command model."""
|
|
83
|
-
|
|
84
|
-
commandType: SetTipStateCommandType = "setTipState"
|
|
85
|
-
params: SetTipStateParams
|
|
86
|
-
result: Optional[SetTipStateResult] = None
|
|
87
|
-
|
|
88
|
-
_ImplementationCls: Type[SetTipStateImplementation] = SetTipStateImplementation
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
class SetTipStateCreate(BaseCommandCreate[SetTipStateParams]):
|
|
92
|
-
"""Set tip state command creation request model."""
|
|
93
|
-
|
|
94
|
-
commandType: SetTipStateCommandType = "setTipState"
|
|
95
|
-
params: SetTipStateParams
|
|
96
|
-
|
|
97
|
-
_CommandCls: Type[SetTipState] = SetTipState
|