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

feat(api, performance-metrics): track analysis execution #14902

Closed

Conversation

DerekMaggio
Copy link
Member

@DerekMaggio DerekMaggio commented Apr 15, 2024

Overview

Closes https://opentrons.atlassian.net/browse/EXEC-399

Changelog

opentrons-shared-data Project

  • Add shared types to performance/dev_types.py
  • Define SupportsTracking mypy Protocol
  • Move RobotContextState from performance-metrics to shared-data

performance-metrics Library

  • Export RobotContextTracker to allow utilization of library
  • Add constants file, which contains file names for different performance metrics. I figured this was just as easy as providing a temporary name and then changing it later
  • RobotContextTracker
    • Conditionally import timing functions based on OS. This is to address CI actions that were failing on Windows
    • RobotContextTracker is a structural subtype of SupportsTracking

robot_server Project

  • Add performance-metrics library as a dev dependency

api Project

  • Add performance-metrics library as a dev dependency
  • Add singleton initialization of RobotContextTracker inside the api project
  • Decorate _analyze function with tracker
  • Initialize the performance_metrics_data directory inside the data directory on the robot

Test Plan

  • Add unit test cases for tracking analysis
  • Verify on OT-2
  • Verify on Flex

Review requests

  • Should I move RobotContextStates to shared_data?
  • Is the weirdness import weirdness I did in test_cli.py okay?
from opentrons import get_robot_context_tracker


# Enable tracking for the RobotContextTracker
# This must come before the import of the analyze CLI
context_tracker = get_robot_context_tracker()
context_tracker._should_track = True

from opentrons.cli.analyze import analyze  # noqa: E402

Risk assessment

Low, hidden behind feature flag which defaults to being False

@DerekMaggio DerekMaggio changed the title EXEC-399-track-analysis-context feat(api, performance-metrics): track analysis execution Apr 15, 2024
@DerekMaggio DerekMaggio force-pushed the EXEC-399-track-analysis-context branch from c8c9696 to 2e3160e Compare April 16, 2024 17:23
@DerekMaggio DerekMaggio changed the base branch from edge to EXEC-406-time-function-bug April 16, 2024 17:28
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.

None yet

1 participant