Skip to content

Commit

Permalink
Merge pull request #1356 from GSA/debug_s3_partitioning
Browse files Browse the repository at this point in the history
debug s3 partitioning
  • Loading branch information
ccostino authored Oct 3, 2024
2 parents ae5c0d2 + 4abd540 commit f87e710
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions app/aws/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,9 @@ def file_exists(file_location):


def get_job_location(service_id, job_id):
current_app.logger.info(
f"#s3-partitioning NEW JOB_LOCATION: {NEW_FILE_LOCATION_STRUCTURE.format(service_id, job_id)}"
)
return (
current_app.config["CSV_UPLOAD_BUCKET"]["bucket"],
NEW_FILE_LOCATION_STRUCTURE.format(service_id, job_id),
Expand All @@ -279,6 +282,9 @@ def get_old_job_location(service_id, job_id):
but it will take a few days where we have to support both formats.
Remove this when everything works with the NEW_FILE_LOCATION_STRUCTURE.
"""
current_app.logger.info(
f"#s3-partitioning OLD JOB LOCATION: {FILE_LOCATION_STRUCTURE.format(service_id, job_id)}"
)
return (
current_app.config["CSV_UPLOAD_BUCKET"]["bucket"],
FILE_LOCATION_STRUCTURE.format(service_id, job_id),
Expand Down Expand Up @@ -486,6 +492,9 @@ def get_personalisation_from_s3(service_id, job_id, job_row_number):


def get_job_metadata_from_s3(service_id, job_id):
current_app.logger.info(
f"#s3-partitioning CALLING GET_JOB_METADATA with {service_id}, {job_id}"
)
obj = get_s3_object(*get_job_location(service_id, job_id))
return obj.get()["Metadata"]

Expand Down
1 change: 1 addition & 0 deletions app/job/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ def create_job(service_id):
original_file_name = data.get("original_file_name")
data.update({"service": service_id})
try:
current_app.logger.info(f"#s3-partitioning DATA IN CREATE_JOB: {data}")
data.update(**get_job_metadata_from_s3(service_id, data["id"]))
except KeyError:
raise InvalidRequest(
Expand Down
1 change: 0 additions & 1 deletion app/user/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,6 @@ def fetch_user_by_email():
fetched_user = get_user_by_email(email["email"])
debug_not_production(hilite(f"fetched user is {fetched_user}"))
result = fetched_user.serialize()
debug_not_production(hilite(f"result is serialized to {result}"))
return jsonify(data=result)
except Exception as e:
debug_not_production(hilite(f"Failed with {e}!!"))
Expand Down

0 comments on commit f87e710

Please sign in to comment.