-
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.
feat: configure performance-metrics to work on robot (#15316)
# Overview Adds packaging scripts and configuration to enable pushing and running performance metrics on a robot. Currently running analysis and getting a cached analysis are the only things that are tracked on the robot Closes https://opentrons.atlassian.net/browse/EXEC-497 # Test Plan - Follow the steps in [README](https://github.com/Opentrons/opentrons/blob/b7274f123ee5cbdd93430a52668d07b0c90b6ae8/performance-metrics/README.md) to setup the env - Run robot analysis for 2-3 different protocols by going to the setup screen for the protocols - Repeat running analysis for each protocol - SSH into the robot and go to /data/performance_metrics_data/ - There should be 2 files - robot_context_data - robot_context_data_headers - Check their content - robot_context_data should have lines that look like this, ``` ANALYZING_PROTOCOL,1718739269730290312,14028043893 GETTING_CACHED_ANALYSIS,1718739323578647179,47381526 ... ``` - robot_context_data_headers should have a single line ``` state_name,function_start_time,duration ``` - After you are finished run `make unset-performance-metrics-ff` - Run a protocol and make sure performance metrics are no longer being recorded. Also, make sure you can still run the analysis and get a cached analysis - [x] Verify analysis and cached analysis on the OT-2 dev server - [x] Verify analysis and cached analysis on the Flex dev server - [x] Verify analysis and cached analysis on OT-2 - [x] Verify analysis and cached analysis on Flex Dev Kit - [x] Verify analysis and cached analysis on Flex @skowalski08 # Changelog ## `performance_helpers.py` - Add TrackingFunctions class which contains functions intended to be used as decorators - Generalize wrapper creation function - Make all other entities in the file private ## `performance-metrics/Makefile` - Add push targets for OT-2 and Flex - Add helper target `update-robot-version` to hack the robot into thinking it is on the same version as the app - Add `set-performance-metrics-ff` and `unset-performance-metrics-ff` - Add a get-logs target ## `performance-metrics/setup.py` Remove shared-data as a dep for performance-metrics as it does not use it ## `robot-server/Pipfile` Remove performance-metrics as a dependency as robot_server is not using it directly ## `robot-server/robot_server/protocols/protocol_analyzer.py` Wrap `analyze` and label it as `ANALYZING_PROTOCOL` ## `robot-server/robot_server/protocols/router.py` Wrap logic that gets cached_analysis and label it as `GETTING_CACHED_PROTOCOL_ANALYSIS` # Review requests - Take a look at my test plan, is there anything else that should be added to reduce the risk? - Am I installing the performance-metrics package correctly on the flex by just unpacking it in `/opt/opentrons-robot-server`? - # Risk assessment Medium? `performance-metrics` is now wrapping production code. But the package is not being built and installed on robots, it has to be pushed by a dev. Furthermore, nothing will be run without setting the feature flag
- Loading branch information
1 parent
cdbc6c1
commit 4247d54
Showing
15 changed files
with
534 additions
and
228 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 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
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,3 +1,71 @@ | ||
# Performance Metrics | ||
|
||
Project to gather various performance metrics for the Opentrons Flex. | ||
Library to gather various performance metrics for the Opentrons Flex. | ||
|
||
Currently being imported inside of `opentrons.util.performance_helpers` which defines | ||
helper function used inside other projects | ||
|
||
## Setup | ||
|
||
It is assumed that you already have the other projects in the monorepo setup correctly. | ||
|
||
```bash | ||
make -C performance-metrics setup | ||
``` | ||
|
||
### Testing against OT-2 Dev Server | ||
|
||
```bash | ||
make -C robot-server dev-ot2 | ||
``` | ||
|
||
### Testing against real OT-2 | ||
|
||
To push development packages to OT-2 run the following commands from the root directory of this repo: | ||
|
||
```bash | ||
make -C performance-metrics push-no-restart host=<ot2-ip> | ||
make -C api push-no-restart host=<ot2-ip> | ||
make -C robot-server push host=<ot2-ip> | ||
``` | ||
|
||
### Testing against Flex Dev Server | ||
|
||
```bash | ||
make -C robot-server dev-flex | ||
``` | ||
|
||
### Testing against real Flex | ||
|
||
```bash | ||
make -C performance-metrics push-no-restart-ot3 host=<flex-ip> | ||
make -C api push-no-restart-ot3 host=<flex-ip> | ||
make -C robot-server push-ot3 host=<flex-ip> | ||
``` | ||
|
||
### Extra step when running against real robots | ||
|
||
Once this is done you might need to hack getting your robot and app to think they are on the same version. | ||
Go to your app -> Settings -> General and find your app version | ||
|
||
Then run | ||
|
||
```bash | ||
make -C performance-metrics override-robot-version version=<app-version> host=<robot-ip> | ||
``` | ||
|
||
this will make the app think that the robot is on the same version | ||
|
||
### Enabling performance-metrics feature flag | ||
|
||
Performance metrics usage is hidden behind a feature flag. To enable it run the following command: | ||
|
||
```bash | ||
make set-performance-metrics-ff host=<ip> | ||
``` | ||
|
||
To disable it run: | ||
|
||
```bash | ||
make unset-performance-metrics-ff host=<ip> | ||
``` |
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,11 @@ | ||
[bdist_wheel] | ||
universal = 1 | ||
|
||
[metadata] | ||
license_files = ../LICENSE | ||
|
||
[pep8] | ||
ignore = E221,E222 | ||
|
||
[aliases] | ||
test=pytest |
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
Oops, something went wrong.