Skip to content

Commit

Permalink
ABR Robot, Pipette, Gripper Lifetime (#15523)
Browse files Browse the repository at this point in the history
<!--
Thanks for taking the time to open a pull request! Please make sure
you've read the "Opening Pull Requests" section of our Contributing
Guide:


https://github.com/Opentrons/opentrons/blob/edge/CONTRIBUTING.md#opening-pull-requests

To ensure your code is reviewed quickly and thoroughly, please fill out
the sections below to the best of your ability!
-->

# Overview

Adds lifetime % to abr data sheet for gripper, pipettes, and robot.

# Test Plan

<!--
Use this section to describe the steps that you took to test your Pull
Request.
If you did not perform any testing provide justification why.

OT-3 Developers: You should default to testing on actual physical
hardware.
Once again, if you did not perform testing against hardware, justify
why.

Note: It can be helpful to write a test plan before doing development

Example Test Plan (HTTP API Change)

- Verified that new optional argument `dance-party` causes the robot to
flash its lights, move the pipettes,
then home.
- Verified that when you omit the `dance-party` option the robot homes
normally
- Added protocol that uses `dance-party` argument to G-Code Testing
Suite
- Ran protocol that did not use `dance-party` argument and everything
was successful
- Added unit tests to validate that changes to pydantic model are
correct

-->

# Changelog

<!--
List out the changes to the code in this PR. Please try your best to
categorize your changes and describe what has changed and why.

Example changelog:
- Fixed app crash when trying to calibrate an illegal pipette
- Added state to API to track pipette usage
- Updated API docs to mention only two pipettes are supported

IMPORTANT: MAKE SURE ANY BREAKING CHANGES ARE PROPERLY COMMUNICATED
-->

# Review requests

<!--
Describe any requests for your reviewers here.
-->

# Risk assessment

<!--
Carefully go over your pull request and look at the other parts of the
codebase it may affect. Look for the possibility, even if you think it's
small, that your change may affect some other part of the system - for
instance, changing return tip behavior in protocol may also change the
behavior of labware calibration.

Identify the other parts of the system your codebase may affect, so that
in addition to your own review and testing, other people who may not
have the system internalized as much as you can focus their attention
and testing there.
-->
  • Loading branch information
rclarke0 authored Jul 8, 2024
1 parent 1578adf commit d4ee4af
Show file tree
Hide file tree
Showing 6 changed files with 286 additions and 41 deletions.
3 changes: 2 additions & 1 deletion abr-testing/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ opentrons-hardware = {editable = true, path = "./../hardware", extras=['FLEX']}
opentrons = {editable = true, path = "./../api", extras=['flex-hardware']}
slackclient = "*"
slack-sdk = "*"
scikit-learn = "*"
pandas = "*"
pandas-stubs = "*"


[dev-packages]
atomicwrites = "==1.4.1"
Expand Down
77 changes: 48 additions & 29 deletions abr-testing/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 8 additions & 5 deletions abr-testing/abr_testing/data_collection/abr_google_drive.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from abr_testing.data_collection import read_robot_logs
from typing import Set, Dict, Any, Tuple, List, Union
from abr_testing.automation import google_drive_tool, google_sheets_tool
from abr_testing.tools import sync_abr_sheet


def get_modules(file_results: Dict[str, str]) -> Dict[str, Any]:
Expand Down Expand Up @@ -184,10 +185,10 @@ def create_data_dictionary(
google_sheet = google_sheets_tool.google_sheet(
credentials_path, google_sheet_name, 0
)

run_ids_on_gs = google_sheet.get_column(2)
run_ids_on_gs = set(run_ids_on_gs)

# Get run ids on google sheet
run_ids_on_gs = set(google_sheet.get_column(2))
# Get robots on google sheet
robots = list(set(google_sheet.get_column(1)))
# Uploads files that are not in google drive directory
google_drive.upload_missing_files(storage_directory)

Expand All @@ -203,14 +204,16 @@ def create_data_dictionary(
transposed_runs_and_lpc,
headers_lpc,
) = create_data_dictionary(missing_runs_from_gs, storage_directory, "", "", "")

start_row = google_sheet.get_index_row() + 1
print(start_row)
google_sheet.batch_update_cells(transposed_runs_and_robots, "A", start_row, "0")
# Calculate Robot Lifetimes

# Add LPC to google sheet
google_sheet_lpc = google_sheets_tool.google_sheet(credentials_path, "ABR-LPC", 0)
start_row_lpc = google_sheet_lpc.get_index_row() + 1
google_sheet_lpc.batch_update_cells(
transposed_runs_and_lpc, "A", start_row_lpc, "0"
)
robots = list(set(google_sheet.get_column(1)))
sync_abr_sheet.determine_lifetime(google_sheet)
14 changes: 9 additions & 5 deletions abr-testing/abr_testing/data_collection/get_run_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@
def get_run_ids_from_robot(ip: str) -> Set[str]:
"""Get all completed runs from each robot."""
run_ids = set()
response = requests.get(
f"http://{ip}:31950/runs", headers={"opentrons-version": "3"}
)
run_data = response.json()
run_list = run_data["data"]
try:
response = requests.get(
f"http://{ip}:31950/runs", headers={"opentrons-version": "3"}
)
run_data = response.json()
run_list = run_data["data"]
except requests.exceptions.RequestException:
print(f"Could not connect to robot with IP {ip}")
run_list = []
for run in run_list:
run_id = run["id"]
if not run["current"]:
Expand Down
2 changes: 1 addition & 1 deletion abr-testing/abr_testing/data_collection/read_robot_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ def get_error_info(file_results: Dict[str, Any]) -> Tuple[int, str, str, str, st
error_type = run_command_error["error"].get("errorType", "")
if error_type == "PythonException":
# Reassign error_type to be more descriptive
error_type = run_command_error["detail"].split(":")[0]
error_type = run_command_error.get("detail", "").split(":")[0]
error_code = run_command_error["error"].get("errorCode", "")
try:
# Instrument Error
Expand Down
Loading

0 comments on commit d4ee4af

Please sign in to comment.