Skip to content

Commit

Permalink
run orchestrator engine and runner as prop
Browse files Browse the repository at this point in the history
  • Loading branch information
TamarZanzouri committed May 16, 2024
1 parent 1e630f5 commit 32a4957
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
22 changes: 16 additions & 6 deletions api/src/opentrons/protocol_runner/run_orchestrator.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from __future__ import annotations
from typing import Optional, Union

from . import protocol_runner
from . import protocol_runner, AnyRunner
from ..hardware_control import HardwareControlAPI
from ..protocol_engine import ProtocolEngine
from ..protocol_engine.types import PostRunHardwareState
Expand Down Expand Up @@ -31,6 +31,16 @@ def __init__(
self._setup_runner = setup_runner
self._fixit_runner = fixit_runner

@property
def engine(self) -> ProtocolEngine:
"""Get the "current" persisted ProtocolEngine."""
return self._protocol_engine

@property
def runner(self) -> AnyRunner:
"""Get the "current" persisted ProtocolRunner."""
return self._json_or_python_runner or self._setup_runner

@classmethod
def build_orchestrator(
cls,
Expand Down Expand Up @@ -73,8 +83,8 @@ def build_orchestrator(
protocol_engine=protocol_engine,
)

def get_protocol_runner(self) -> protocol_runner.AnyRunner:
return self._json_or_python_runner or self._setup_runner

def get_protocol_engine(self) -> ProtocolEngine:
return self._protocol_engine
# def get_protocol_runner(self) -> protocol_runner.AnyRunner:
# return self._json_or_python_runner or self._setup_runner
#
# def get_protocol_engine(self) -> ProtocolEngine:
# return self._protocol_engine
4 changes: 2 additions & 2 deletions robot-server/robot_server/runs/engine_store.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,14 @@ def engine(self) -> ProtocolEngine:
"""Get the "current" persisted ProtocolEngine."""
if self._run_orchestrator is None:
raise NoRunnerEnginePairError()
return self._run_orchestrator.get_protocol_engine()
return self._run_orchestrator.engine

@property
def runner(self) -> AnyRunner:
"""Get the "current" persisted ProtocolRunner."""
if self._run_orchestrator is None:
raise NoRunnerEnginePairError()
return self._run_orchestrator.get_protocol_runner()
return self._run_orchestrator.runner

@property
def current_run_id(self) -> Optional[str]:
Expand Down

0 comments on commit 32a4957

Please sign in to comment.