Skip to content

Commit c87e3e0

Browse files
authored
feat (abr-testing): Low Volume 96ch Protocols + Full Liquid Set up Protocol (#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. -->
1 parent e4b1716 commit c87e3e0

10 files changed

+1137
-862
lines changed

abr-testing/abr_testing/data_collection/abr_robot_error.py

Lines changed: 62 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,64 @@
1717
from abr_testing.tools import plate_reader
1818

1919

20-
def retrieve_protocol_file(
21-
protocol_id: str,
20+
def retrieve_version_file(
2221
robot_ip: str,
2322
storage: str,
2423
) -> Path | str:
25-
"""Find and copy protocol file on robot with error."""
26-
protocol_dir = f"/var/lib/opentrons-robot-server/7.1/protocols/{protocol_id}"
24+
"""Retrieve Version file."""
25+
version_file_path = "/etc/VERSION.json"
26+
save_dir = Path(f"{storage}")
27+
print(save_dir)
28+
command = ["scp", "-r", f"root@{robot_ip}:{version_file_path}", save_dir]
29+
try:
30+
subprocess.run(command, check=True) # type: ignore
31+
return os.path.join(save_dir, "VERSION.json")
32+
except subprocess.CalledProcessError as e:
33+
print(f"Error during file transfer: {e}")
34+
return ""
35+
36+
37+
def retrieve_protocol_file(protocol_id: str, robot_ip: str, storage: str) -> Path | str:
38+
"""Find and copy protocol file on robot with error handling."""
39+
# List folders in the robot's directory
40+
list_folder_command = [
41+
"ssh",
42+
f"root@{robot_ip}",
43+
"ls /var/lib/opentrons-robot-server",
44+
]
45+
try:
46+
result = subprocess.run(
47+
list_folder_command, check=True, capture_output=True, text=True
48+
)
49+
folders = result.stdout.splitlines()
50+
51+
def convert_to_floats(data: List) -> List:
52+
"""Convert list to floats."""
53+
float_list = []
54+
for item in data:
55+
try:
56+
float_value = float(item)
57+
float_list.append(float_value)
58+
except ValueError:
59+
pass # Ignore items that cannot be converted to float
60+
return float_list
61+
62+
folders_float = convert_to_floats(folders)
63+
if not folders_float:
64+
print("No folders found.")
65+
return ""
66+
folder_num = max(
67+
folders_float
68+
) # Assuming the highest folder number is the latest
69+
if folder_num.is_integer():
70+
folder_num = int(folder_num)
71+
except subprocess.CalledProcessError:
72+
print("Could not find folder.")
73+
return ""
74+
protocol_dir = (
75+
f"/var/lib/opentrons-robot-server/{folder_num}/protocols/{protocol_id}"
76+
)
77+
2778
# Copy protocol file found in robot onto host computer
2879
save_dir = Path(f"{storage}")
2980
command = ["scp", "-r", f"root@{robot_ip}:{protocol_dir}", save_dir]
@@ -366,6 +417,8 @@ def get_run_error_info_from_robot(
366417
description = dict()
367418
# get run information
368419
results = get_run_logs.get_run_data(one_run, ip)
420+
# Get version file
421+
369422
# save run information to local directory as .json file
370423
saved_file_path = read_robot_logs.save_run_log_to_json(
371424
ip, results, storage_directory
@@ -545,6 +598,8 @@ def get_run_error_info_from_robot(
545598
except requests.exceptions.InvalidURL:
546599
print("Invalid IP address.")
547600
sys.exit()
601+
version_file_dir = retrieve_version_file(robot_ip=ip, storage=storage_directory)
602+
version_file_path = os.path.join(storage_directory, version_file_dir)
548603
if len(run_or_other) < 1:
549604
# Retrieve the most recently run protocol file
550605
protocol_folder = retrieve_protocol_file(
@@ -611,12 +666,14 @@ def get_run_error_info_from_robot(
611666
# OPEN TICKET
612667
issue_url = ticket.open_issue(issue_key)
613668
# MOVE FILES TO ERROR FOLDER.
669+
print(version_file_path)
670+
print(run_log_file_path)
614671
error_files = [
615672
saved_file_path_calibration,
616673
run_log_file_path,
617674
protocol_file_path,
675+
version_file_path,
618676
] + file_paths
619-
620677
error_folder_path = os.path.join(storage_directory, issue_key)
621678
os.makedirs(error_folder_path, exist_ok=True)
622679
for source_file in error_files:

abr-testing/abr_testing/data_collection/get_run_logs.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ def get_run_data(one_run: Any, ip: str) -> Dict[str, Any]:
3636
params={"cursor": 0, "pageLength": 0},
3737
)
3838
data = response.json()
39-
command_count = data["meta"]["totalLength"]
39+
try:
40+
command_count = data["meta"]["totalLength"]
41+
except KeyError:
42+
command_count = 0
4043
page_length = 100
4144
commands = list()
4245
run = dict()

abr-testing/abr_testing/protocols/active_protocols/4_Illumina DNA Enrichment.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,9 @@ def tipcheck() -> None:
372372
if trash_lid:
373373
protocol.move_labware(lid_on_plate, trash_bin, use_gripper=True)
374374
elif len(used_lids) <= 1:
375-
protocol.move_labware(lid_on_plate, "B4", use_gripper=True)
375+
protocol.move_labware(
376+
lid_on_plate, deck_riser, use_gripper=True
377+
)
376378
else:
377379
protocol.move_labware(
378380
lid_on_plate, used_lids[-2], use_gripper=True

0 commit comments

Comments
 (0)