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(emulation): integrated with module control #8586

Merged
merged 19 commits into from
Nov 4, 2021

Conversation

amitlissack
Copy link
Contributor

@amitlissack amitlissack commented Oct 23, 2021

Overview

This PR completes refactor of how our module emulation works.

This is part 2. The hardware controller connects to ModuleServer to discover emulated modules.

This is part 1

This PR opens up hot plugging modules and "multiples of a module" in emulation.

Changelog

  • Fill out ModuleServer and its client and utils.
  • Expanded Module emulator settings. This is essential for "multiples of a module" as serial number is the disambiguator.
  • docker-compose changes to add module clients.
  • DOCKER.md update.

Review requests

Tests will not pass due to g-code-testing. The way emulators connect is no longer 100% predictable. This means variation in g-codes.

Risk assessment

None. This is a PR into a feature branch.

@amitlissack amitlissack requested review from DerekMaggio and a team October 23, 2021 14:16
@codecov
Copy link

codecov bot commented Oct 23, 2021

Codecov Report

Merging #8586 (26db3e2) into emulation-refactor-phase-2 (b1c2391) will increase coverage by 0.07%.
The diff coverage is 87.55%.

Impacted file tree graph

@@                      Coverage Diff                       @@
##           emulation-refactor-phase-2    #8586      +/-   ##
==============================================================
+ Coverage                       75.14%   75.22%   +0.07%     
==============================================================
  Files                            1797     1801       +4     
  Lines                           47668    47720      +52     
  Branches                         4648     4648              
==============================================================
+ Hits                            35820    35897      +77     
+ Misses                          11047    11022      -25     
  Partials                          801      801              
Flag Coverage Δ
api 84.66% <88.05%> (+0.17%) ⬆️
g-code-testing 97.28% <84.37%> (+0.14%) ⬆️
robot-server 93.45% <ø> (ø)

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

Impacted Files Coverage Δ
.../src/opentrons/hardware_control/emulation/proxy.py 91.76% <ø> (ø)
...e_control/emulation/scripts/run_module_emulator.py 75.00% <ø> (ø)
api/src/opentrons/hardware_control/simulator.py 85.41% <ø> (-0.20%) ⬇️
...ardware_control/emulation/module_server/helpers.py 76.36% <76.36%> (ø)
...hardware_control/emulation/module_server/server.py 80.00% <80.00%> (ø)
g-code-testing/g_code_parsing/g_code_engine.py 92.50% <84.37%> (+1.91%) ⬆️
...hardware_control/emulation/module_server/client.py 94.11% <94.11%> (ø)
api/src/opentrons/hardware_control/api.py 83.66% <100.00%> (ø)
api/src/opentrons/hardware_control/controller.py 80.79% <100.00%> (-0.11%) ⬇️
...rc/opentrons/hardware_control/emulation/magdeck.py 92.30% <100.00%> (-0.20%) ⬇️
... and 9 more

@amitlissack amitlissack changed the base branch from edge to emulation-refactor-phase-2 October 23, 2021 14:18
@amitlissack amitlissack force-pushed the emulation-module-control branch from 5d6c134 to 4b3e6b2 Compare October 23, 2021 14:19
@amitlissack amitlissack force-pushed the emulation-refactor-phase-2 branch from 12fff3b to 6ae4a1e Compare October 23, 2021 14:21
@amitlissack amitlissack force-pushed the emulation-module-control branch from 4b3e6b2 to dfe0d68 Compare October 23, 2021 14:23
@amitlissack amitlissack changed the title refactor(emulation): WIP refactor(emulation): (WIP) integrated with module control Oct 23, 2021
@amitlissack amitlissack force-pushed the emulation-module-control branch from 605723d to 042ff36 Compare October 25, 2021 15:15
@amitlissack amitlissack force-pushed the emulation-refactor-phase-2 branch from e5ffa15 to b1c2391 Compare October 27, 2021 16:29
@amitlissack amitlissack changed the title refactor(emulation): (WIP) integrated with module control refactor(emulation): integrated with module control Oct 27, 2021
@amitlissack amitlissack marked this pull request as ready for review October 29, 2021 13:36
@amitlissack amitlissack requested review from a team as code owners October 29, 2021 13:36
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.

It looks good to me but since it does include changes to core hardware control code we should test it on hardware

if not api_instance.is_simulator:
await mc_instance.register_modules(mc_instance.scan())
api_instance.loop.create_task(
Copy link
Member

Choose a reason for hiding this comment

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

So does this get instantiated in true hardware controllers running in the server on an actual OT2?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It does. What do you think? Is there possibly a reason to have emulated modules + real modules?

Happy to disable on robot.

@amitlissack amitlissack marked this pull request as draft October 29, 2021 14:31
@amitlissack amitlissack marked this pull request as ready for review October 29, 2021 19:59
@amitlissack amitlissack merged commit d79d8b3 into emulation-refactor-phase-2 Nov 4, 2021
@amitlissack amitlissack deleted the emulation-module-control branch November 4, 2021 17:38
amitlissack pushed a commit that referenced this pull request Nov 9, 2021
* Module control refactors

* new package.

* start module control integration.

* tests for module control integration.

* implement connection listener.

* module server integrated into module control.

* lint

* g-code-testing

* redo docker compose to deal with separate emulator apps.

* usb port.

* expand module emulation settings.

* update docker readme.

* format-js

* lint

* go back to threadings. I don't want to debug windows nonsense.

* fix bug.

* redo gcode testing's emulator setup.

* documentation.

* clean up.
amitlissack pushed a commit that referenced this pull request Nov 9, 2021
* proxy.

run_emulator

* Linting/Formatting

* emulator

* integration tests pass.

* lint passes.

* gcode parsing.

* gcode parsing uses process for emulator.

* run_emulator_client retries.

* wait for emulator connection method.

* scripts.

* utils

* g-code-testing lint

* refactor(emulation):  integrated with module control (#8586)

* Module control refactors

* new package.

* start module control integration.

* tests for module control integration.

* implement connection listener.

* module server integrated into module control.

* lint

* g-code-testing

* redo docker compose to deal with separate emulator apps.

* usb port.

* expand module emulation settings.

* update docker readme.

* format-js

* lint

* go back to threadings. I don't want to debug windows nonsense.

* fix bug.

* redo gcode testing's emulator setup.

* documentation.

* clean up.

* don't listen for emulators on robot.

* chore(gcode): reduce time of gcode-testing (#8683)

* faster g-code-tests in ci

* reduce hold time.

* use dev folder in s3

* wait.

Co-authored-by: Derek Maggio <[email protected]>
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.

2 participants