pudl.deploy.s3_transfer#
Fast bulk uploads to, and server-side copies within, Amazon S3.
s3fs is fine for listing, deleting and small transfers, but it is several times
slower than boto3 for the two operations that move the FERC EQR outputs
(~120 GiB, mostly 3-4 GiB Parquet files):
Uploads:
s3fskeeps at most 10 HTTP connections open by default, which limits throughput on the long-RTT GCP -> AWS path. The CRT transfer client inboto3saturates it.Server-side copies:
s3fscopies each object with a single serial stream of 50 MiBUploadPartCopyrequests (~70 MB/s per object, whatever the block size), while theboto3transfer manager copies the parts of each object in parallel. On a 4-file benchmark it was ~6x faster (1.3 GB/s vs ~0.2 GB/s).
Everything else – listing, deletion, verification, and all non-S3 targets –
stays on fsspec/UPath. All uri arguments are full s3://bucket/key
URIs; callers pass the whole batch so one transfer manager is shared by all of
its files.
Attributes#
Functions#
|
Split an |
|
Return a boto3 S3 client bound to bucket's region. |
|
Upload each |
|
Server-side copy each |
Module Contents#
- pudl.deploy.s3_transfer.split_s3_uri(uri: str) tuple[str, str][source]#
Split an
s3://bucket/keyURI into(bucket, key).
- pudl.deploy.s3_transfer._client(bucket: str)[source]#
Return a boto3 S3 client bound to bucket’s region.
The region is looked up with
get_bucket_location(which needs no redirect), so a missing or wrongAWS_REGIONdoes not matter.
- pudl.deploy.s3_transfer.upload_files(files: collections.abc.Iterable[tuple[pathlib.Path, str]]) None[source]#
Upload each
(local_path, s3_uri)pair with the CRT transfer client.Blocks until every upload has finished; raises the first failure.