Skip to content

Commit

Permalink
Merge branch 'release-1.19.5'
Browse files Browse the repository at this point in the history
* release-1.19.5:
  Bumping version to 1.19.5
  Add changelog entries from botocore
  Add get_partition_for_region to Session (#3060)
  Add max_bandwidth to TransferConfig (#3059)
  • Loading branch information
aws-sdk-python-automation committed Oct 27, 2021
2 parents a426ea0 + 6967a2d commit 527297d
Show file tree
Hide file tree
Showing 9 changed files with 118 additions and 11 deletions.
42 changes: 42 additions & 0 deletions .changes/1.19.5.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[
{
"category": "``autoscaling``",
"description": "[``botocore``] This release adds support for attribute-based instance type selection, a new EC2 Auto Scaling feature that lets customers express their instance requirements as a set of attributes, such as vCPU, memory, and storage.",
"type": "api-change"
},
{
"category": "``ec2``",
"description": "[``botocore``] This release adds: attribute-based instance type selection for EC2 Fleet, Spot Fleet, a feature that lets customers express instance requirements as attributes like vCPU, memory, and storage; and Spot placement score, a feature that helps customers identify an optimal location to run Spot workloads.",
"type": "api-change"
},
{
"category": "Session",
"description": "Added `get_partition_for_region` to lookup partition for a given region_name",
"type": "enhancement"
},
{
"category": "``eks``",
"description": "[``botocore``] EKS managed node groups now support BOTTLEROCKET_x86_64 and BOTTLEROCKET_ARM_64 AMI types.",
"type": "api-change"
},
{
"category": "``sagemaker``",
"description": "[``botocore``] This release allows customers to describe one or more versioned model packages through BatchDescribeModelPackage, update project via UpdateProject, modify and read customer metadata properties using Create, Update and Describe ModelPackage and enables cross account registration of model packages.",
"type": "api-change"
},
{
"category": "Session",
"description": "[``botocore``] Added `get_partition_for_region` allowing partition lookup by region name.",
"type": "enhancement"
},
{
"category": "``textract``",
"description": "[``botocore``] This release adds support for asynchronously analyzing invoice and receipt documents through two new APIs: StartExpenseAnalysis and GetExpenseAnalysis",
"type": "api-change"
},
{
"category": "``s3``",
"description": "TransferConfig now supports the `max_bandwidth` argument.",
"type": "enchancement"
}
]
13 changes: 13 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@
CHANGELOG
=========

1.19.5
======

* api-change:``autoscaling``: [``botocore``] This release adds support for attribute-based instance type selection, a new EC2 Auto Scaling feature that lets customers express their instance requirements as a set of attributes, such as vCPU, memory, and storage.
* api-change:``ec2``: [``botocore``] This release adds: attribute-based instance type selection for EC2 Fleet, Spot Fleet, a feature that lets customers express instance requirements as attributes like vCPU, memory, and storage; and Spot placement score, a feature that helps customers identify an optimal location to run Spot workloads.
* enhancement:Session: Added `get_partition_for_region` to lookup partition for a given region_name
* api-change:``eks``: [``botocore``] EKS managed node groups now support BOTTLEROCKET_x86_64 and BOTTLEROCKET_ARM_64 AMI types.
* api-change:``sagemaker``: [``botocore``] This release allows customers to describe one or more versioned model packages through BatchDescribeModelPackage, update project via UpdateProject, modify and read customer metadata properties using Create, Update and Describe ModelPackage and enables cross account registration of model packages.
* enhancement:Session: [``botocore``] Added `get_partition_for_region` allowing partition lookup by region name.
* api-change:``textract``: [``botocore``] This release adds support for asynchronously analyzing invoice and receipt documents through two new APIs: StartExpenseAnalysis and GetExpenseAnalysis
* enchancement:``s3``: TransferConfig now supports the `max_bandwidth` argument.


1.19.4
======

Expand Down
2 changes: 1 addition & 1 deletion boto3/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@


__author__ = 'Amazon Web Services'
__version__ = '1.19.4'
__version__ = '1.19.5'


# The default Boto3 session; autoloaded when needed.
Expand Down
24 changes: 16 additions & 8 deletions boto3/s3/transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,17 @@ class TransferConfig(S3TransferConfig):
'max_io_queue': 'max_io_queue_size'
}

def __init__(self,
multipart_threshold=8 * MB,
max_concurrency=10,
multipart_chunksize=8 * MB,
num_download_attempts=5,
max_io_queue=100,
io_chunksize=256 * KB,
use_threads=True):
def __init__(
self,
multipart_threshold=8 * MB,
max_concurrency=10,
multipart_chunksize=8 * MB,
num_download_attempts=5,
max_io_queue=100,
io_chunksize=256 * KB,
use_threads=True,
max_bandwidth=None,
):
"""Configuration object for managed S3 transfers
:param multipart_threshold: The transfer size threshold for which
Expand Down Expand Up @@ -209,6 +212,10 @@ def __init__(self,
:param use_threads: If True, threads will be used when performing
S3 transfers. If False, no threads will be used in
performing transfers: all logic will be ran in the main thread.
:param max_bandwidth: The maximum bandwidth that will be consumed
in uploading and downloading file content. The value is an integer
in terms of bytes per second.
"""
super(TransferConfig, self).__init__(
multipart_threshold=multipart_threshold,
Expand All @@ -217,6 +224,7 @@ def __init__(self,
num_download_attempts=num_download_attempts,
max_io_queue_size=max_io_queue,
io_chunksize=io_chunksize,
max_bandwidth=max_bandwidth,
)
# Some of the argument names are not the same as the inherited
# S3TransferConfig so we add aliases so you can still access the
Expand Down
12 changes: 12 additions & 0 deletions boto3/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,18 @@ def get_credentials(self):
"""
return self._session.get_credentials()

def get_partition_for_region(self, region_name):
"""Lists the partition name of a particular region.
:type region_name: string
:param region_name: Name of the region to list partition for (e.g.,
us-east-1).
:rtype: string
:return: Returns the respective partition name (e.g., aws).
"""
return self._session.get_partition_for_region(region_name)

def client(self, service_name, region_name=None, api_version=None,
use_ssl=True, verify=None, endpoint_url=None,
aws_access_key_id=None, aws_secret_access_key=None,
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ universal = 0

[metadata]
requires_dist =
botocore>=1.22.4,<1.23.0
botocore>=1.22.5,<1.23.0
jmespath>=0.7.1,<1.0.0
s3transfer>=0.5.0,<0.6.0

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


requires = [
'botocore>=1.22.4,<1.23.0',
'botocore>=1.22.5,<1.23.0',
'jmespath>=0.7.1,<1.0.0',
's3transfer>=0.5.0,<0.6.0'
]
Expand Down
21 changes: 21 additions & 0 deletions tests/unit/s3/test_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
from boto3.s3.transfer import S3Transfer
from boto3.s3.transfer import OSUtils, TransferConfig, ProgressCallbackInvoker
from boto3.s3.transfer import ClientError, S3TransferRetriesExceededError
from boto3.s3.transfer import KB, MB


class TestCreateTransferManager(unittest.TestCase):
Expand Down Expand Up @@ -83,6 +84,26 @@ def test_alias_max_io_queue(self):
self.assert_value_of_actual_and_alias(
config, 'max_io_queue_size', 'max_io_queue', new_value)

def test_transferconfig_parameters(self):
config = TransferConfig(
multipart_threshold=8 * MB,
max_concurrency=10,
multipart_chunksize=8 * MB,
num_download_attempts=5,
max_io_queue=100,
io_chunksize=256 * KB,
use_threads=True,
max_bandwidth=1024 * KB,
)
assert config.multipart_threshold == 8 * MB
assert config.multipart_chunksize == 8 * MB
assert config.max_request_concurrency == 10
assert config.num_download_attempts == 5
assert config.max_io_queue_size == 100
assert config.io_chunksize == 256 * KB
assert config.use_threads is True
assert config.max_bandwidth == 1024 * KB


class TestProgressCallbackInvoker(unittest.TestCase):
def test_on_progress(self):
Expand Down
11 changes: 11 additions & 0 deletions tests/unit/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,17 @@ def test_get_available_regions(self):
)
assert partitions == ['foo']

def test_get_partition_for_region(self):
bc_session = mock.Mock()
bc_session.get_partition_for_region.return_value = 'baz'
session = Session(botocore_session=bc_session)

partition = session.get_partition_for_region('foo-bar-1')
bc_session.get_partition_for_region.assert_called_with(
'foo-bar-1'
)
assert partition == 'baz'

def test_create_client(self):
session = Session(region_name='us-east-1')
client = session.client('sqs', region_name='us-west-2')
Expand Down

0 comments on commit 527297d

Please sign in to comment.