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

refactor(api, robot-server): redirect router level calls to PE and protocol_runners via run orchestrator #15257

Merged
merged 41 commits into from
Jun 11, 2024

Conversation

TamarZanzouri
Copy link
Contributor

@TamarZanzouri TamarZanzouri commented May 23, 2024

Overview

second phase of run orchestrator. redirect all router level calls via run_orchestrator.

Test Plan

  • All e2e tests are passing.
  • through it on a robot and make sure nothing is broken. -> tests this with dev server.
    • test json protocols
    • test python protocols
    • post commands to a run
    • post commands with default router

Changelog

  • added method calls from run_data_manager and routers to engine_store.
  • all calls get through run_orchestrator to PE and to runners.

Review requests

changes make sense? will something break? do we like this change? should I add more tests?

Risk assessment

Medium. tested with dev server and all tests are passing but still a fundamental change.

Copy link

codecov bot commented Jun 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.43%. Comparing base (1e66d70) to head (20202f1).
Report is 216 commits behind head on edge.

Current head 20202f1 differs from pull request most recent head a1121d1

Please upload reports for the commit a1121d1 to get more accurate results.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             edge   #15257   +/-   ##
=======================================
  Coverage   92.43%   92.43%           
=======================================
  Files          77       77           
  Lines        1283     1283           
=======================================
  Hits         1186     1186           
  Misses         97       97           
Flag Coverage Δ
g-code-testing 92.43% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

@TamarZanzouri TamarZanzouri marked this pull request as ready for review June 10, 2024 13:53
@TamarZanzouri TamarZanzouri requested a review from a team as a code owner June 10, 2024 13:53
@TamarZanzouri TamarZanzouri changed the title Exec 418 use orchestrator in router chore(api, robot-server): redirect router level calls to PE and protocol_runners via run orchestrator Jun 10, 2024
Copy link
Member

@sfoster1 sfoster1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks really good, thanks for taking it on! Let's fix up some docstring copypasta and test it, but the structure looks great!

api/src/opentrons/protocol_runner/run_orchestrator.py Outdated Show resolved Hide resolved
api/src/opentrons/protocol_runner/run_orchestrator.py Outdated Show resolved Hide resolved
api/src/opentrons/protocol_runner/run_orchestrator.py Outdated Show resolved Hide resolved
robot-server/robot_server/runs/engine_store.py Outdated Show resolved Hide resolved
robot-server/robot_server/runs/engine_store.py Outdated Show resolved Hide resolved
@TamarZanzouri TamarZanzouri requested a review from sfoster1 June 10, 2024 18:00
Copy link
Contributor

@SyntaxColoring SyntaxColoring left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you! This mostly makes sense to me so far and I think we should keep going. A few questions:

Comment on lines 321 to 325
def prepare(self) -> None:
"""Prepare live runner for a run."""
self._setup_runner.prepare()
self._fixit_runner.prepare()
self._protocol_live_runner.prepare()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks a little questionable that self._setup_runner.prepare() and self._fixit_runner.prepare() are called for live HTTP runs (because that's the only thing calling RunOrchestrator.prepare()), and are not called for JSON or Python protocols. In all cases, the setup runner and fixit runner behave the same, right? So shouldn't they consistently always be .prepare()'d or never be .prepare()'d?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. I will fix it.

api/src/opentrons/protocol_runner/run_orchestrator.py Outdated Show resolved Hide resolved
api/src/opentrons/protocol_runner/run_orchestrator.py Outdated Show resolved Hide resolved
robot-server/tests/runs/router/test_commands_router.py Outdated Show resolved Hide resolved
robot-server/tests/runs/test_engine_store.py Outdated Show resolved Hide resolved
@SyntaxColoring
Copy link
Contributor

Oh and this should probably be refactor instead of chore since it's meaningfully affecting production code.

Copy link
Member

@sfoster1 sfoster1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @SyntaxColoring about the prepare thing, we should have an explicit reason why we're not doing it, but other than that looks good!

@TamarZanzouri TamarZanzouri changed the title chore(api, robot-server): redirect router level calls to PE and protocol_runners via run orchestrator refactor(api, robot-server): redirect router level calls to PE and protocol_runners via run orchestrator Jun 10, 2024
@TamarZanzouri TamarZanzouri merged commit e7882fd into edge Jun 11, 2024
20 checks passed
@TamarZanzouri TamarZanzouri deleted the EXEC-418-use-orchestrator-in-router branch June 11, 2024 18:29
aaron-kulkarni pushed a commit that referenced this pull request Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants