Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(api, robot-server): Manage runners via run orchestrator #15190

Merged
merged 51 commits into from
May 17, 2024
Merged
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
347c193
initial copy of the queues into the runners
TamarZanzouri Apr 25, 2024
d75461b
WIP starting to move setting the queue to the runner
TamarZanzouri Apr 25, 2024
37e24e8
un commenting the command history and coping add to queue to runner
TamarZanzouri Apr 26, 2024
311a2c0
add_command logic and QueuedCommandAction managment
TamarZanzouri Apr 26, 2024
ad54fce
clean-up
TamarZanzouri Apr 28, 2024
a1e2511
cleanup
TamarZanzouri Apr 28, 2024
bc4131c
comments and renaming
TamarZanzouri Apr 29, 2024
27a1438
started creating the orchestrator
TamarZanzouri Apr 29, 2024
3c40e6b
add_command in orchestrator not complete
TamarZanzouri Apr 30, 2024
9cfaf4c
removed list of commands from runners
TamarZanzouri May 1, 2024
fa53544
cleanup and progress with direction
TamarZanzouri May 2, 2024
f5415ea
restructure
TamarZanzouri May 2, 2024
c47ea33
base tests
TamarZanzouri May 2, 2024
8716bd4
tests progress not done!
TamarZanzouri May 2, 2024
ef5e2a0
fixed order of parameters
TamarZanzouri May 6, 2024
aaca024
json specific
TamarZanzouri May 6, 2024
a2719c8
changed test to assert that the command was entered
TamarZanzouri May 7, 2024
3dd5ed8
added provider and tests. not complete
TamarZanzouri May 7, 2024
05df2f0
type cleanup
TamarZanzouri May 7, 2024
0136801
changed import of runners. prepare for monkeypatch
TamarZanzouri May 7, 2024
12f6fd1
added monkeypatch
TamarZanzouri May 7, 2024
b57b38c
moved build method inside orchestrator
TamarZanzouri May 7, 2024
d89186c
add command test
TamarZanzouri May 7, 2024
840e83f
changed to classmethod
TamarZanzouri May 8, 2024
7fb9f21
fixed return type from classmethod
TamarZanzouri May 8, 2024
6294a54
added abstract method and implementations
TamarZanzouri May 8, 2024
5be263b
fixed setting configs
TamarZanzouri May 8, 2024
fc4b912
moved monkeypatch into builer test
TamarZanzouri May 8, 2024
9fb1013
fixed failing tests
TamarZanzouri May 8, 2024
2467b88
split subjects to python and json
TamarZanzouri May 9, 2024
cf79e55
WIP engine_store using orchestrator
TamarZanzouri May 9, 2024
3317464
export and import orchestrator
TamarZanzouri May 10, 2024
e45663f
WIP navigate runner/engine via orchestrator
TamarZanzouri May 10, 2024
0a0bb5c
use orchestrator for runner and not optinal for run_id and runner
TamarZanzouri May 13, 2024
7962013
lint and thoughts
TamarZanzouri May 14, 2024
19fbee9
added missing load and prepare methods
TamarZanzouri May 14, 2024
5702c5c
fixed failing tests and added setup runner for default runner
TamarZanzouri May 14, 2024
4f8a49c
get_default_engine for stateless commands WIP
TamarZanzouri May 14, 2024
072c4e9
fixed get_default_engine
TamarZanzouri May 15, 2024
9e4a3e8
removed add_command changes
TamarZanzouri May 15, 2024
635a4e3
branch cleanup
TamarZanzouri May 15, 2024
1e630f5
pr clean-up
TamarZanzouri May 15, 2024
32a4957
run orchestrator engine and runner as prop
TamarZanzouri May 16, 2024
e85fca5
explicit type for runners
TamarZanzouri May 16, 2024
4da9372
docstrings
TamarZanzouri May 16, 2024
b63f97c
renaming, removed LiveRunner from create_runner. pr feedback.
TamarZanzouri May 16, 2024
3ed461b
docstring
TamarZanzouri May 16, 2024
61baa72
removed comments
TamarZanzouri May 16, 2024
da94cdf
cleanup
TamarZanzouri May 17, 2024
91c8a13
merge conflicts
TamarZanzouri May 17, 2024
62d43a8
fixed merge test fail
TamarZanzouri May 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
added abstract method and implementations
  • Loading branch information
TamarZanzouri committed May 8, 2024
commit 6294a544713f1144adcf44620cc05f6409ced428
17 changes: 13 additions & 4 deletions api/src/opentrons/protocol_runner/protocol_runner.py
Original file line number Diff line number Diff line change
@@ -142,7 +142,8 @@ async def run(
) -> RunResult:
"""Run a given protocol to completion."""

def set_command_queued(self, command: CommandCreate) -> None:
@abstractmethod
def set_command_queued(self, command: CommandCreate) -> CommandCreate:
"""add command to queue."""


@@ -186,6 +187,10 @@ def run_time_parameters(self) -> List[RunTimeParameter]:
return self._parameter_context.export_parameters_for_analysis()
return []

def set_command_queued(self, command: CommandCreate) -> CommandCreate:
"""add command to queue."""
return command

async def load(
self,
protocol_source: ProtocolSource,
@@ -384,13 +389,15 @@ async def _add_command_and_execute(self) -> None:
message=f"{result.error.errorType}: {result.error.detail}",
)

def set_command_queued(self, command: CommandCreate) -> None:
def set_command_queued(self, command: CommandCreate) -> CommandCreate:
"""add command to queue."""
self._add_to_queue(command)
return command

def _add_to_queue(self, command: CommandCreate) -> None:
def _add_to_queue(self, command: CommandCreate) -> CommandCreate:
"""Add new ID to the queued."""
self._queued_protocol_commands.append(command)
return command


class LiveRunner(AbstractRunner):
@@ -433,13 +440,15 @@ async def run( # noqa: D102
commands = self._protocol_engine.state_view.commands.get_all()
return RunResult(commands=commands, state_summary=run_data, parameters=[])

def set_command_queued(self, command: CommandCreate) -> None:
def set_command_queued(self, command: CommandCreate) -> CommandCreate:
"""add command to queue."""
if command.intent == CommandIntent.SETUP:
self._add_to_setup_queue(command)
elif command.intent == CommandIntent.FIXIT:
self._add_to_fixit_queue(command)

return command

def _add_to_setup_queue(self, command: CommandCreate) -> None:
"""Add a new ID to the queued setup."""
self._queued_setup_commands.append(command)
8 changes: 4 additions & 4 deletions api/src/opentrons/protocol_runner/run_orchestrator.py
DerekMaggio marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -79,7 +79,7 @@ def build_orchestrator(

def add_command(
self, request: CommandCreate, failed_command_id: Optional[str] = None
) -> Command:
) -> CommandCreate:
"""Add a command to the queue.

Arguments:
@@ -105,11 +105,11 @@ def add_command(

# pass the failed_command_id somewhere
if request.intent == CommandIntent.SETUP:
self._setup_runner.set_command_queued(request)
return self._setup_runner.set_command_queued(request)
elif request.intent == CommandIntent.FIXIT:
self._fixit_runner.set_command_queued(request)
return self._fixit_runner.set_command_queued(request)
elif (
request.intent == CommandIntent.PROTOCOL
and self._json_or_python_runner is not None
):
self._json_or_python_runner.set_command_queued(request)
return self._json_or_python_runner.set_command_queued(request)
Original file line number Diff line number Diff line change
@@ -153,6 +153,7 @@ def test_add_command(
command_to_queue = pe_commands.HomeCreate.construct(
intent=command_intent, params=pe_commands.HomeParams.construct()
)
subject.add_command(command_to_queue)
result = subject.add_command(command_to_queue)
assert result == command_to_queue

decoy.verify(runner.set_command_queued(command_to_queue))
Loading