Skip to content

Commit

Permalink
better timing
Browse files Browse the repository at this point in the history
  • Loading branch information
davedavemckay committed Feb 4, 2025
1 parent cd55217 commit 0d15930
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions scripts/process_collated_zips.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,12 @@ def extract_and_upload(row, conn, bucket_name):
conn.put_object(bucket_name,key,content_file_data)
# dprint(f'Uploaded {content_file} to {key}', flush=True)
end = datetime.now()
duration = end - start
if duration.seconds > 0:
dprint(f'Extracted and uploaded contents of {row["key"]} in {duration.seconds:.2f} s ({size/1024**2/duration.seconds} MiB/s).', flush=True)
else:
dprint(f'Extracted and uploaded contents of {row["key"]} in {duration.seconds:.2f} s.', flush=True)
duration = (end - start).microseconds / 1e6 + (end - start).seconds
try:
dprint(f'Extracted and uploaded contents of {row["key"]} in {duration:.2f} s ({size/1024**2/duration} MiB/s).', flush=True)
except ZeroDivisionError:
dprint(f'Extracted and uploaded contents of {row["key"]} in {duration:.2f} s', flush=True)

return True
else:
return False
Expand Down

0 comments on commit 0d15930

Please sign in to comment.