-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
jira ticket adds url to abr-run-data sheet
- Loading branch information
Showing
8 changed files
with
126 additions
and
53 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
"""Get LPC Values from Run logs and pair with calibration.""" |
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]: | ||
|
@@ -139,19 +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 | ||
) | ||
read_robot_logs.get_logs(storage_directory, ip) | ||
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") |
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