-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(engine): pause hardware API when engine is paused (#10882)
- Loading branch information
Showing
30 changed files
with
290 additions
and
364 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 5 additions & 14 deletions
19
api/src/opentrons/protocol_engine/create_protocol_engine.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,31 @@ | ||
"""Main ProtocolEngine factory.""" | ||
from opentrons.hardware_control import HardwareControlAPI | ||
from opentrons.hardware_control.types import DoorState | ||
from opentrons.config import feature_flags | ||
|
||
from .protocol_engine import ProtocolEngine | ||
from .resources import DeckDataProvider | ||
from .state import StateStore, EngineConfigs | ||
from .state import Config, StateStore | ||
|
||
|
||
async def create_protocol_engine( | ||
hardware_api: HardwareControlAPI, | ||
configs: EngineConfigs = EngineConfigs(), | ||
config: Config, | ||
) -> ProtocolEngine: | ||
"""Create a ProtocolEngine instance. | ||
Arguments: | ||
hardware_api: Hardware control API to pass down to dependencies. | ||
configs: Protocol Engine configurations. | ||
config: ProtocolEngine configuration. | ||
""" | ||
# TODO(mc, 2020-11-18): check short trash FF | ||
deck_data = DeckDataProvider() | ||
deck_definition = await deck_data.get_deck_definition() | ||
deck_fixed_labware = await deck_data.get_deck_fixed_labware(deck_definition) | ||
# TODO(mc, 2021-09-22): figure out a better way to load deck data that | ||
# can more consistently handle Python vs JSON vs legacy differences | ||
|
||
is_door_blocking = ( | ||
feature_flags.enable_door_safety_switch() | ||
and hardware_api.door_state is DoorState.OPEN | ||
) | ||
|
||
state_store = StateStore( | ||
config=config, | ||
deck_definition=deck_definition, | ||
deck_fixed_labware=deck_fixed_labware, | ||
configs=configs, | ||
is_door_blocking=is_door_blocking, | ||
is_door_open=hardware_api.door_state is DoorState.OPEN, | ||
) | ||
|
||
return ProtocolEngine(state_store=state_store, hardware_api=hardware_api) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
"""Top-level ProtocolEngine configuration options.""" | ||
from dataclasses import dataclass | ||
|
||
|
||
@dataclass(frozen=True) | ||
class Config: | ||
"""ProtocolEngine configuration options. | ||
Params: | ||
ignore_pause: The engine should no-op instead of waiting | ||
for pauses and delays to complete. | ||
use_virtual_modules: The engine should no-op instead of calling | ||
modules' hardware control API. | ||
block_on_door_open: Protocol execution should pause if the | ||
front door is opened. | ||
""" | ||
|
||
ignore_pause: bool = False | ||
use_virtual_modules: bool = False | ||
block_on_door_open: bool = False |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.