Skip to content

Commit

Permalink
fix(abr-testing): added error handling for run log parsing (#16867)
Browse files Browse the repository at this point in the history
<!--
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

Added error handling to run log parsing when run logs are empty due to
failed protocol analysis

## Test Plan and Hands on Testing

tested both scripts for 3 days using `make abr-setup` command.

## Changelog

- `get_run_logs.py` added error handling for key error
- `abr_google_drive.py` added error handling for json parsing

## Review requests

<!--
- What do you need from reviewers to feel confident this PR is ready to
merge?
- Ask questions.
-->

## 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 Nov 18, 2024
1 parent ad40bff commit 1e6df83
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion abr-testing/abr_testing/data_collection/abr_google_drive.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ def create_data_dictionary(
file_path = os.path.join(storage_directory, filename)
if file_path.endswith(".json"):
with open(file_path) as file:
file_results = json.load(file)
try:
file_results = json.load(file)
except json.decoder.JSONDecodeError:
print(f"Skipped file {file_path} bc no data.")
continue
else:
continue
if not isinstance(file_results, dict):
Expand Down
2 changes: 1 addition & 1 deletion abr-testing/abr_testing/data_collection/get_run_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def get_run_ids_from_robot(ip: str) -> Set[str]:
f"http://{ip}:31950/runs", headers={"opentrons-version": "3"}
)
run_data = response.json()
run_list = run_data["data"]
run_list = run_data.get("data", "")
except requests.exceptions.RequestException:
print(f"Could not connect to robot with IP {ip}")
run_list = []
Expand Down

0 comments on commit 1e6df83

Please sign in to comment.