Skip to main content

stsci-aws-utils

Utilities for running STScI software on Amazon Web Services.

S3

The ConcurrentS3Client class streams S3 objects into memory (BytesIO) using multiple concurrent HTTP range requests. In tests on an m4.10xlarge with a 10 Gpbs network connection, we have seen ~ 3x speedup compared to boto3's S3 client. Client credentials and region are configured as for boto3 (environment variables, .aws directory, or instance metadata).

AsyncConcurrentS3Client is similar, but with an async interface.

An example of opening a FITS file from S3 using ConcurrentS3Client:

from stsci_aws_utils.s3 import ConcurrentS3Client
from astropy.io import fits

with ConcurrentS3Client() as client:
    content = client.get_object("some-s3-bucket", "some/key/prefix/some-file.fits")
    hdul = fits.open(content)

Note that when making successive requests, it is more efficient to reuse an open client than to create a new one every time. It is possible to create the client without context management, but you'll need to remember to call the close() method yourself:

client = ConcurrentS3Client()

# ...

client.close()

Otherwise, you'll see a cryptic complaint written to stderr by aiohttp.

If you find yourself in a situation where it's inconvenient to close the client (maybe you're implementing a module method), atexit is at your service:

import atexit

CLIENT = ConcurrentS3Client()
atexit.register(CLIENT.close)

It ensures that close is called before normal program exit.

Release files for stsci-aws-utils 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stsci-aws-utils 0.1.2
File Size Uploaded
stsci_aws_utils-0.1.2.tar.gz 13.7 kB Details

Release files / stsci_aws_utils-0.1.2.tar.gz

Download URL stsci_aws_utils-0.1.2.tar.gz
Size 13.7 kB
Tags Source
SHA-256 checksum
How to use checksums
90f2d225a06a32586a16a7e35ae9b32578c2846c1eec85aa453731c23741d03a
BLAKE2b-256 checksum
How to use checksums
522c2d46739ae8724090770b198b9c201fbb9eef1eaffd3e8e4c79bd54145aac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3

Release history Release notifications | RSS feed

This release

0.1.2 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page