-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better error handling when there are no crashes to process #1518
Conversation
return | ||
if cli_args.s3_download and not extracts_todo: | ||
# always short circuit if we find nothing in S3 | ||
raise Exception("No extracts found in S3 bucket") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eeek—I thought we already had a check like this in place but it must have dropped off during one of the later refactors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also could have sworn we were raising an exception already
|
||
if not pdf_count: | ||
raise IOError("No PDFs found in extract") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't need this check anymore since we're handling this elsewhere in the script
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested, but didnt test it when there were no crashes to process.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull up them anchors and 🚢🚢🚢🚢
|
||
no_crashes_found = ( | ||
True if cli_args.csv and records_processed["crashes"] == 0 else False | ||
) | ||
|
||
if cli_args.pdf and not no_crashes_found: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Much more elegant than my hacky fix. Thank you!
Thank you for your reviews! |
Associated issues
crashReports
directory atd-data-tech#18719This issue cropped up when processing ~30 daily CRIS extracts. It seems that occasionally, but not always, the
crashReports
directory is completely missing from the extracts with no crashes. The CSV files are always present.This script makes the following changes:
--csv
and--pdf
and (2) there were no crashes found in the CSV--csv
and--pdf
)Testing
I've left ~30 extracts in the dev inbox which you can use for testing.
--s3-download
command:Ship list