terricain / aioboto3

Wrapper to use boto3 resources with the aiobotocore async backend
Apache License 2.0
698 stars 73 forks source link

aioboto3 doesn't support S3TransferConfig #294

Closed holmuk closed 1 year ago

holmuk commented 1 year ago

Description

S3TransferConfig as assumed in aioboto3.s3.inject doesn't match the definition from boto3.

For example,

max_concurrency = 10 if Config is None else Config.max_concurrency

fails because there is no such field in S3TransferConfig , although it has max_request_concurrency

What I Did

For instance, I want to upload a file-object using a custom config:

chunk_size = 10 * 1024 * 1024

config = S3TransferConfig(
      multipart_threshold=chunk_size,
      multipart_chunksize=chunk_size,
      max_in_memory_upload_chunks=2,
      max_io_queue_size=2,
      max_request_concurrency=1
)

with get_client() as s3:
      await s3.upload_fileobj(fileobj, bucket_name, dst_key, Config=config)

The code fails with AttributeError. As a workaround, I can set the fields manually, but it's not evident that I have to do so to get things working.

config.max_concurrency = 1
config.max_io_queue = 2
terricain commented 1 year ago

Makes sense, not kept on top of the S3 transfer config options so it seems they've changed since I last looked at them :smile: will have a look at fixing it.

terricain commented 1 year ago

Should be fixed in v11.0.0, reopen if not.