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

fix(airflow-s3): Remove print, fix bucket_name arg #691

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions terraform/modules/services/airflow/dags/utils/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ def determine_latest_zarr(bucket: str, prefix: str):
# Get the size of the most recent zarr and the latest.zarr zarr
s3bucket = s3hook.get_bucket(bucket_name=bucket)
size_old, size_new = (0, 0)
print(s3hook.list_keys(bucket_name=bucket, prefix=prefix + "/latest.zarr/"))
if len(zarrs) == 0:
s3hook.log.info("No non-latest zarrs found in bucket, exiting")
return
Expand All @@ -30,7 +29,7 @@ def determine_latest_zarr(bucket: str, prefix: str):
if prefix + "/latest.zarr/" in prefixes:
s3hook.log.debug(f"Deleting {prefix}/latest.zarr/")
keys_to_delete = s3hook.list_keys(bucket_name=bucket, prefix=prefix + "/latest.zarr/")
s3hook.delete_objects(bucket_name=bucket, keys=keys_to_delete)
s3hook.delete_objects(bucket=bucket, keys=keys_to_delete)
# Copy the new latest.zarr
s3hook.log.info(f"Copying {zarrs[0]} to {prefix}/latest.zarr/")
source_keys = s3hook.list_keys(bucket_name=bucket, prefix=zarrs[0])
Expand Down