Skip to content
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

VZE | Download CR3 "NoSuchKey The specified key does not exist" error #1272

Merged
merged 10 commits into from
Aug 25, 2023

Conversation

roseeichelmann
Copy link
Contributor

@roseeichelmann roseeichelmann commented Aug 16, 2023

Associated issues

Closes cityofaustin/atd-data-tech#13021'

This is a script for our toolbox for fixing the above error in the VZE which is caused by crashes having the cr3_stored_flag set to Y when we dont actually have a CR3 for them in our AWS S3 bucket. This script updates that flag for those crashes to be N which allows the CR3 downloader to download the missing CR3s when it next runs. Follow up issue is to figure out why this desyncing happened in the first place.

I already ran the script for staging & prod which fixed the issue, this PR is just to review the code to put in our toolbox for potential future needs if this ever happens again.

Testing

URL to test:
You can test this script locally if youd like!

Steps to test:

  1. Follow steps in the readme

Ship list

  • Code reviewed
  • Product manager approved

Copy link
Contributor

@mddilley mddilley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this on production, and I saw 0 crashes needing updates - just as expected! 🎉 Thanks for adding this to the toolbox. It will be nice to have if we ever need to run it again or adapt it into an ETL (which i really hope not). 🙏 🚀

crashes_with_cr3_flag_list = []
for crash in crashes_with_cr3_flag:
crashes_with_cr3_flag_list.append(str(crash["crash_id"]))
crashes_to_update = list(set(crashes_with_cr3_flag_list) - set(crashes_with_cr3s))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oooo nice that you used sets here 🚀

"Writing names of cr3 pdfs we have in s3 to a new file in this directory called 's3_cr3_file_names.txt', this can take a few minutes..."
)
aws = subprocess.Popen(
["aws", "s3", "ls", "s3://atd-vision-zero-editor/production/cris-cr3-files/"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cool to see an alternative to using boto3. Using that library would probably have produced more code too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lol i didnt even think to use that library/didnt know about it!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh cool - totally valid either way! 😎

Copy link
Member

@patrickm02L patrickm02L left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review

Approved. Thanks for running the script in Prod & Staging. Glad we have a new 🔧 for the 🧰

Testing

Testing the example crashes from Issue #13021 in Production worked
https://visionzero.austin.gov/editor/#/crashes/19662002
https://visionzero.austin.gov/editor/#/crashes/19659622

I don't think those crashes are in Staging. I put the crash ID in the URL and also did a search and couldn't find them.

I did not test locally

Copy link
Member

@chiaberry chiaberry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@roseeichelmann roseeichelmann merged commit 9bff281 into master Aug 25, 2023
8 checks passed
@roseeichelmann roseeichelmann deleted the add_missing_cr3s branch August 25, 2023 19:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VZE | Download CR3 "NoSuchKey The specified key does not exist" error
4 participants