You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: performance-metrics/README.md
+26-23Lines changed: 26 additions & 23 deletions
Original file line number
Diff line number
Diff line change
@@ -13,29 +13,7 @@ It is assumed that you already have the other projects in the monorepo setup cor
13
13
make -C performance-metrics setup
14
14
```
15
15
16
-
### Testing against OT-2 Dev Server
17
-
18
-
```bash
19
-
make -C robot-server dev-ot2
20
-
```
21
-
22
-
### Testing against real OT-2
23
-
24
-
To push development packages to OT-2 run the following commands from the root directory of this repo:
25
-
26
-
```bash
27
-
make -C performance-metrics push-no-restart host=<ot2-ip>
28
-
make -C api push-no-restart host=<ot2-ip>
29
-
make -C robot-server push host=<ot2-ip>
30
-
```
31
-
32
-
### Testing against Flex Dev Server
33
-
34
-
```bash
35
-
make -C robot-server dev-flex
36
-
```
37
-
38
-
### Testing against real Flex
16
+
### Pushing performance-metrics package to Flex
39
17
40
18
```bash
41
19
make -C performance-metrics push-no-restart-ot3 host=<flex-ip>
@@ -69,3 +47,28 @@ To disable it run:
69
47
```bash
70
48
make unset-performance-metrics-ff host=<ip>
71
49
```
50
+
51
+
## Available features
52
+
53
+
### Robot activity tracking
54
+
55
+
#### Description
56
+
57
+
Developers are able to track when the robot is in a block of code they choose to monitor. Looking at
58
+
`api/src/opentrons/util/performance_helpers.py` you will see a class called `TrackingFunctions`. This class
59
+
defines static methods which are decorators that can be used wrap arbitrary functions.
60
+
61
+
As of 2024-07-31, the following tracking functions are available:
62
+
-`track_analysis`
63
+
-`track_getting_cached_protocol_analysis`
64
+
65
+
Looking at `TrackingFunctions.track_analysis` we see that the underlying call to _track_a_function specifies a string `"ANALYZING_PROTOCOL"`. Whenever a function that is wrapped with `TrackingFunctions.track_analysis` executes, the tracking function will label the underlying function as `"ANALYZING_PROTOCOL"`.
66
+
67
+
To see where tracking function is used look at `robot_server/robot-server/protocols/protocol_analyzer.py`. You will see that the `ProtocolAnalyzer.analyze` function is wrapped with `TrackingFunctions.track_analysis`. Whenever `ProtocolAnalyzer.analyze` is called, the tracking function will start a timer. When the `ProtocolAnalyzer.analyze` function completes, the tracking function will stop the timer. It will then store the function start time and duration to the csv file, /data/performance_metrics_data/robot_activity_data
68
+
69
+
#### Adding new tracking decorator
70
+
71
+
To add a new tracking decorator, go to `performance-metrics/src/performance_metrics/_types.py`, and look at RobotActivityState literal and add a new state.
72
+
Go to `api/src/opentrons/util/performance_helpers.py` and add a static method to the `TrackingFunctions` class that uses the new state.
73
+
74
+
You can now wrap your functions with your new tracking decorator.
0 commit comments