Skip to content

Commit

Permalink
Saves robot logs as .log when reporting error (#15113)
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

Saves robot logs as .log when reporting error

# Test Plan

Ran script on robot and compared log format to logs that are downloaded
through the app.

# Changelog

In the get_robot_logs function I changed the files to be saved as .log
and removed json.dumps()

# 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 May 7, 2024
1 parent ba3586c commit ab4117d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion abr-testing/abr_testing/automation/jira_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def create_ticket(
}
try:
response = requests.post(
f"{self.url}/rest/api/3/issue/",
f"{self.url}/rest/api/3/issue",
headers=self.headers,
auth=self.auth,
json=data,
Expand Down
1 change: 1 addition & 0 deletions abr-testing/abr_testing/data_collection/abr_robot_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ def get_error_info_from_robot(
board_id = args.board_id[0]
reporter_id = args.reporter_id[0]
ticket = jira_tool.JiraTicket(url, api_token, email)
ticket.issues_on_board(board_id)
try:
error_runs = get_error_runs_from_robot(ip)
except requests.exceptions.InvalidURL:
Expand Down
5 changes: 2 additions & 3 deletions abr-testing/abr_testing/data_collection/read_robot_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,11 +486,10 @@ def get_logs(storage_directory: str, ip: str) -> List[str]:
)
response.raise_for_status()
log_data = response.text
log_name = ip + "_" + log_type.split(".")[0] + ".json"
log_name = ip + "_" + log_type.split(".")[0] + ".log"
file_path = os.path.join(storage_directory, log_name)
with open(file_path, mode="w", encoding="utf-8") as file:
file.write(response.text)
json.dump(log_data, open(file_path, mode="w"))
file.write(log_data)
except RuntimeError:
print(f"Request exception. Did not save {log_type}")
continue
Expand Down

0 comments on commit ab4117d

Please sign in to comment.