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

Production Deploy 8/19/2024 #1278

Merged
merged 17 commits into from
Aug 19, 2024
Prev Previous commit
Next Next commit
fix
Kenneth Kehl committed Aug 16, 2024
commit 88f718a906b9ede11e34c35895d4698fd6f815f7
15 changes: 6 additions & 9 deletions app/aws/s3.py
Original file line number Diff line number Diff line change
@@ -183,7 +183,7 @@ def get_job_from_s3(service_id, job_id):
try:
obj = get_s3_object(*get_job_location(service_id, job_id))
return obj.get()["Body"].read().decode("utf-8")
except botocore.exceptions.ClientError as e:
except botocore.exceptions.ClientError:
current_app.logger.error(
f"Failed to get job {FILE_LOCATION_STRUCTURE.format(service_id, job_id)} retry_count={retries}",
exc_info=True,
@@ -204,7 +204,8 @@ def get_job_from_s3(service_id, job_id):
continue

current_app.logger.error(
f"Never retrieved job {FILE_LOCATION_STRUCTURE.format(service_id, job_id)}"
f"Never retrieved job {FILE_LOCATION_STRUCTURE.format(service_id, job_id)}",
exc_info=True,
)
return None

@@ -277,19 +278,15 @@ def get_phone_number_from_s3(service_id, job_id, job_row_number):
if job is None:
current_app.logger.info(f"job {job_id} was not in the cache")
job = get_job_from_s3(service_id, job_id)
# Even if it is None, put it here to avoid KeyErrors
JOBS[job_id] = job
incr_jobs_cache_misses()
else:
incr_jobs_cache_hits()

# If the job is None after our attempt to retrieve it from s3, it
# probably means the job is old and has been deleted from s3, in
# which case there is nothing we can do. It's unlikely to run into
# this, but it could theoretically happen, especially if we ever
# change the task schedules
if job is None:
current_app.logger.warning(
f"Couldnt find phone for job_id {job_id} row number {job_row_number} because job is missing"
current_app.logger.error(
f"Couldnt find phone for job {FILE_LOCATION_STRUCTURE.format(service_id, job_id)} because job is missing"
)
return "Unavailable"

1 change: 0 additions & 1 deletion app/service/rest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import itertools
from datetime import datetime, timedelta

from botocore.exceptions import ClientError
from flask import Blueprint, current_app, jsonify, request
from sqlalchemy.exc import IntegrityError
from sqlalchemy.orm.exc import NoResultFound