本文整理汇总了Python中boto3.exceptions.RetriesExceededError方法的典型用法代码示例。如果您正苦于以下问题:Python exceptions.RetriesExceededError方法的具体用法?Python exceptions.RetriesExceededError怎么用?Python exceptions.RetriesExceededError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类boto3.exceptions
的用法示例。
在下文中一共展示了exceptions.RetriesExceededError方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: download_file
# 需要导入模块: from boto3 import exceptions [as 别名]
# 或者: from boto3.exceptions import RetriesExceededError [as 别名]
def download_file(self, bucket, key, filename, extra_args=None,
callback=None):
"""Download an S3 object to a file.
Variants have also been injected into S3 client, Bucket and Object.
You don't have to use S3Transfer.download_file() directly.
"""
if not isinstance(filename, six.string_types):
raise ValueError('Filename must be a string')
subscribers = self._get_subscribers(callback)
future = self._manager.download(
bucket, key, filename, extra_args, subscribers)
try:
future.result()
# This is for backwards compatibility where when retries are
# exceeded we need to throw the same error from boto3 instead of
# s3transfer's built in RetriesExceededError as current users are
# catching the boto3 one instead of the s3transfer exception to do
# their own retries.
except S3TransferRetriesExceededError as e:
raise RetriesExceededError(e.last_exception)
示例2: _native_download_file
# 需要导入模块: from boto3 import exceptions [as 别名]
# 或者: from boto3.exceptions import RetriesExceededError [as 别名]
def _native_download_file(meta, full_dst_file_name, max_concurrency):
logger = getLogger(__name__)
try:
akey = SnowflakeS3Util._get_s3_object(meta, meta['src_file_name'])
akey.download_file(
full_dst_file_name,
Callback=meta['get_callback'](
meta['src_file_name'],
meta['src_file_size'],
output_stream=meta['get_callback_output_stream'],
show_progress_bar=meta['show_progress_bar']) if
meta['get_callback'] else None,
Config=TransferConfig(
multipart_threshold=SnowflakeS3Util.DATA_SIZE_THRESHOLD,
max_concurrency=max_concurrency,
num_download_attempts=10,
)
)
meta['result_status'] = ResultStatus.DOWNLOADED
except botocore.exceptions.ClientError as err:
if err.response['Error']['Code'] == EXPIRED_TOKEN:
meta['result_status'] = ResultStatus.RENEW_TOKEN
else:
logger.debug(
"Failed to download a file: %s, err: %s",
full_dst_file_name, err, exc_info=True)
raise err
except RetriesExceededError as err:
meta['result_status'] = ResultStatus.NEED_RETRY
meta['last_error'] = err
except OpenSSL.SSL.SysCallError as err:
meta['last_error'] = err
if err.args[0] == ERRORNO_WSAECONNABORTED:
# connection was disconnected by S3
# because of too many connections. retry with
# less concurrency to mitigate it
meta[
'result_status'] = ResultStatus.NEED_RETRY_WITH_LOWER_CONCURRENCY
else:
meta['result_status'] = ResultStatus.NEED_RETRY
示例3: download_file
# 需要导入模块: from boto3 import exceptions [as 别名]
# 或者: from boto3.exceptions import RetriesExceededError [as 别名]
def download_file(self, bucket, key, filename, extra_args=None,
callback=None):
"""Download an S3 object to a file.
Variants have also been injected into S3 client, Bucket and Object.
You don't have to use S3Transfer.download_file() directly.
.. seealso::
:py:meth:`S3.Client.download_file`
:py:meth:`S3.Client.download_fileobj`
"""
if not isinstance(filename, six.string_types):
raise ValueError('Filename must be a string')
subscribers = self._get_subscribers(callback)
future = self._manager.download(
bucket, key, filename, extra_args, subscribers)
try:
future.result()
# This is for backwards compatibility where when retries are
# exceeded we need to throw the same error from boto3 instead of
# s3transfer's built in RetriesExceededError as current users are
# catching the boto3 one instead of the s3transfer exception to do
# their own retries.
except S3TransferRetriesExceededError as e:
raise RetriesExceededError(e.last_exception)