-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add errored runs to abr tracking sheet (#14845)
<!-- 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 <!-- Use this section to describe your pull-request at a high level. If the PR addresses any open issues, please tag the issues here. --> Improved ABR Error Data Collection # Test Plan Tested code on multiple robots. # Changelog Added function to download robot logs Added lines of code to move error documents (run log, calibration log, robot logs) into folder named after ticket. Adds robot run to ABR sheet and links JIRA ticket Added extra lines to abr_scale to read scale more often Edited ABR calibration script to ensure duplicate calibrations are not added. # Review requests Is 5000 lines of recording enough to capture robot error if script is run immediately? Is there any manipulation to robot logs that can be down to make error analysis more efficient. # 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
Showing
9 changed files
with
179 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""Get Unique LPC Values from Run logs.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,13 @@ | |
from abr_testing.data_collection import read_robot_logs, abr_google_drive, get_run_logs | ||
import requests | ||
import argparse | ||
from abr_testing.automation import jira_tool | ||
from abr_testing.automation import jira_tool, google_sheets_tool, google_drive_tool | ||
import shutil | ||
import os | ||
import subprocess | ||
import json | ||
import sys | ||
import gspread # type: ignore[import] | ||
|
||
|
||
def get_error_runs_from_robot(ip: str) -> List[str]: | ||
|
@@ -44,7 +50,6 @@ def get_error_info_from_robot( | |
# JIRA Ticket Fields | ||
failure_level = "Level " + str(error_level) + " Failure" | ||
components = [failure_level, "Flex-RABR"] | ||
components = ["Flex-RABR"] | ||
affects_version = results["API_Version"] | ||
parent = results.get("robot_name", "") | ||
print(parent) | ||
|
@@ -140,18 +145,19 @@ def get_error_info_from_robot( | |
affects_version, | ||
components, | ||
whole_description_str, | ||
saved_file_path, | ||
run_log_file_path, | ||
) = get_error_info_from_robot(ip, one_run, storage_directory) | ||
# get calibration data | ||
saved_file_path_calibration, calibration = read_robot_logs.get_calibration_offsets( | ||
ip, storage_directory | ||
) | ||
file_paths = read_robot_logs.get_logs(storage_directory, ip) | ||
print(f"Making ticket for run: {one_run} on robot {robot}.") | ||
# TODO: make argument or see if I can get rid of with using board_id. | ||
project_key = "RABR" | ||
parent_key = project_key + "-" + robot[-1] | ||
issues_ids = ticket.issues_on_board(board_id) | ||
issue_url, issue_key = ticket.create_ticket( | ||
# CREATE TICKET | ||
issue_key = ticket.create_ticket( | ||
summary, | ||
whole_description_str, | ||
project_key, | ||
|
@@ -162,6 +168,51 @@ def get_error_info_from_robot( | |
affects_version, | ||
parent_key, | ||
) | ||
ticket.open_issue(issue_key) | ||
ticket.post_attachment_to_ticket(issue_key, saved_file_path) | ||
ticket.post_attachment_to_ticket(issue_key, saved_file_path_calibration) | ||
# OPEN TICKET | ||
issue_url = ticket.open_issue(issue_key) | ||
# MOVE FILES TO ERROR FOLDER. | ||
error_files = [saved_file_path_calibration, run_log_file_path] + file_paths | ||
error_folder_path = os.path.join(storage_directory, str("RABR-238")) | ||
os.makedirs(error_folder_path, exist_ok=True) | ||
for source_file in error_files: | ||
destination_file = os.path.join( | ||
error_folder_path, os.path.basename(source_file) | ||
) | ||
shutil.move(source_file, destination_file) | ||
# OPEN FOLDER DIRECTORY | ||
subprocess.Popen(["explorer", error_folder_path]) | ||
# CONNECT TO GOOGLE DRIVE | ||
credentials_path = os.path.join(storage_directory, "credentials.json") | ||
google_sheet_name = "ABR-run-data" | ||
try: | ||
google_drive = google_drive_tool.google_drive( | ||
credentials_path, | ||
"1Cvej0eadFOTZr9ILRXJ0Wg65ymOtxL4m", | ||
"[email protected]", | ||
) | ||
print("Connected to google drive.") | ||
except json.decoder.JSONDecodeError: | ||
print( | ||
"Credential file is damaged. Get from https://console.cloud.google.com/apis/credentials" | ||
) | ||
sys.exit() | ||
# CONNECT TO GOOGLE SHEET | ||
try: | ||
google_sheet = google_sheets_tool.google_sheet( | ||
credentials_path, google_sheet_name, 0 | ||
) | ||
print(f"Connected to google sheet: {google_sheet_name}") | ||
except gspread.exceptions.APIError: | ||
print("ERROR: Check google sheet name. Check credentials file.") | ||
sys.exit() | ||
# WRITE ERRORED RUN TO GOOGLE SHEET | ||
error_run_log = os.path.join(error_folder_path, os.path.basename(run_log_file_path)) | ||
google_drive.upload_file(error_run_log) | ||
run_id = os.path.basename(error_run_log).split("_")[1].split(".")[0] | ||
runs_and_robots, headers = abr_google_drive.create_data_dictionary( | ||
run_id, error_folder_path, issue_url | ||
) | ||
read_robot_logs.write_to_local_and_google_sheet( | ||
runs_and_robots, storage_directory, google_sheet_name, google_sheet, headers | ||
) | ||
print("Wrote run to ABR-run-data") |
Oops, something went wrong.