Skip to content

Commit

Permalink
feat (abr-testing): Low Volume 96ch Protocols + Full Liquid Set up Pr…
Browse files Browse the repository at this point in the history
…otocol (#17475)

<!--
Thanks for taking the time to open a Pull Request (PR)! 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

GitHub provides robust markdown to format your PR. Links, diagrams,
pictures, and videos along with text formatting make it possible to
create a rich and informative PR. For more information on GitHub
markdown, see:


https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax

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

# Overview

Low Volume 96ch pipette protocol

## Test Plan and Hands on Testing

- tested protocols on robots


## Changelog

Added 3 protocols
- 2 96ch low volume ones at api 2.23
- corrected some error recording issues with retrieving protocol files
- created protocol to fill all plates for robots with a 96ch

## Review requests

@sfoster1 I have noticed that the robots will have their protocol files
saved in different numbered folders with opentrons-robot-server. How can
I get this scrip to iterate these folders to find the file that matches
the protocol_id?

## Risk assessment

<!--
- Indicate the level of attention this PR needs.
- Provide context to guide reviewers.
- Discuss trade-offs, coupling, and side effects.
- 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 may also change the
behavior of labware calibration.
- How do your unit tests and on hands on testing mitigate this PR's
risks and the risk of future regressions?
- Especially in high risk PRs, explain how you know your testing is
enough.
-->
  • Loading branch information
rclarke0 authored Feb 14, 2025
1 parent e4b1716 commit c87e3e0
Show file tree
Hide file tree
Showing 10 changed files with 1,137 additions and 862 deletions.
67 changes: 62 additions & 5 deletions abr-testing/abr_testing/data_collection/abr_robot_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,64 @@
from abr_testing.tools import plate_reader


def retrieve_protocol_file(
protocol_id: str,
def retrieve_version_file(
robot_ip: str,
storage: str,
) -> Path | str:
"""Find and copy protocol file on robot with error."""
protocol_dir = f"/var/lib/opentrons-robot-server/7.1/protocols/{protocol_id}"
"""Retrieve Version file."""
version_file_path = "/etc/VERSION.json"
save_dir = Path(f"{storage}")
print(save_dir)
command = ["scp", "-r", f"root@{robot_ip}:{version_file_path}", save_dir]
try:
subprocess.run(command, check=True) # type: ignore
return os.path.join(save_dir, "VERSION.json")
except subprocess.CalledProcessError as e:
print(f"Error during file transfer: {e}")
return ""


def retrieve_protocol_file(protocol_id: str, robot_ip: str, storage: str) -> Path | str:
"""Find and copy protocol file on robot with error handling."""
# List folders in the robot's directory
list_folder_command = [
"ssh",
f"root@{robot_ip}",
"ls /var/lib/opentrons-robot-server",
]
try:
result = subprocess.run(
list_folder_command, check=True, capture_output=True, text=True
)
folders = result.stdout.splitlines()

def convert_to_floats(data: List) -> List:
"""Convert list to floats."""
float_list = []
for item in data:
try:
float_value = float(item)
float_list.append(float_value)
except ValueError:
pass # Ignore items that cannot be converted to float
return float_list

folders_float = convert_to_floats(folders)
if not folders_float:
print("No folders found.")
return ""
folder_num = max(
folders_float
) # Assuming the highest folder number is the latest
if folder_num.is_integer():
folder_num = int(folder_num)
except subprocess.CalledProcessError:
print("Could not find folder.")
return ""
protocol_dir = (
f"/var/lib/opentrons-robot-server/{folder_num}/protocols/{protocol_id}"
)

# Copy protocol file found in robot onto host computer
save_dir = Path(f"{storage}")
command = ["scp", "-r", f"root@{robot_ip}:{protocol_dir}", save_dir]
Expand Down Expand Up @@ -366,6 +417,8 @@ def get_run_error_info_from_robot(
description = dict()
# get run information
results = get_run_logs.get_run_data(one_run, ip)
# Get version file

# save run information to local directory as .json file
saved_file_path = read_robot_logs.save_run_log_to_json(
ip, results, storage_directory
Expand Down Expand Up @@ -545,6 +598,8 @@ def get_run_error_info_from_robot(
except requests.exceptions.InvalidURL:
print("Invalid IP address.")
sys.exit()
version_file_dir = retrieve_version_file(robot_ip=ip, storage=storage_directory)
version_file_path = os.path.join(storage_directory, version_file_dir)
if len(run_or_other) < 1:
# Retrieve the most recently run protocol file
protocol_folder = retrieve_protocol_file(
Expand Down Expand Up @@ -611,12 +666,14 @@ def get_run_error_info_from_robot(
# OPEN TICKET
issue_url = ticket.open_issue(issue_key)
# MOVE FILES TO ERROR FOLDER.
print(version_file_path)
print(run_log_file_path)
error_files = [
saved_file_path_calibration,
run_log_file_path,
protocol_file_path,
version_file_path,
] + file_paths

error_folder_path = os.path.join(storage_directory, issue_key)
os.makedirs(error_folder_path, exist_ok=True)
for source_file in error_files:
Expand Down
5 changes: 4 additions & 1 deletion abr-testing/abr_testing/data_collection/get_run_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ def get_run_data(one_run: Any, ip: str) -> Dict[str, Any]:
params={"cursor": 0, "pageLength": 0},
)
data = response.json()
command_count = data["meta"]["totalLength"]
try:
command_count = data["meta"]["totalLength"]
except KeyError:
command_count = 0
page_length = 100
commands = list()
run = dict()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,9 @@ def tipcheck() -> None:
if trash_lid:
protocol.move_labware(lid_on_plate, trash_bin, use_gripper=True)
elif len(used_lids) <= 1:
protocol.move_labware(lid_on_plate, "B4", use_gripper=True)
protocol.move_labware(
lid_on_plate, deck_riser, use_gripper=True
)
else:
protocol.move_labware(
lid_on_plate, used_lids[-2], use_gripper=True
Expand Down
Loading

0 comments on commit c87e3e0

Please sign in to comment.