question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

boto2.num_retries equivalent in retryhandler.py or _retry.json

See original GitHub issue

Hi!

I have a problem with using logic to retry failed requests.

lsb_release:    Ubuntu 14.04.4 LTS

---
Name: botocore
Version: 1.4.11
Location: /usr/local/lib/python2.7/dist-packages
Requires: docutils, jmespath, python-dateutil
14:00:52 Traceback (most recent call last):
14:00:52   File "deploy_scripts/gen-sg.py", line 638, in <module>
14:00:52     main()
14:00:52   File "deploy_scripts/gen-sg.py", line 631, in main
14:00:52     gsga_results = _get_all_IPs()
14:00:52   File "deploy_scripts/gen-sg.py", line 420, in _get_all_IPs
14:00:52     security_group_addresses = _get_all_IPs_for_Stacks(stacks_security_groups)
14:00:52   File "deploy_scripts/gen-sg.py", line 407, in _get_all_IPs_for_Stacks
14:00:52     security_group_addresses.update(_get_all_IPs_for_Groups(client, sec_groups))
14:00:52   File "deploy_scripts/gen-sg.py", line 387, in _get_all_IPs_for_Groups
14:00:52     groups = client.desc_sg(GroupIds=sec_groups)
14:00:52   File "/usr/lib/python2.7/site-packages/botocore/client.py", line 228, in _api_call
14:00:52     return self._make_api_call(operation_name, kwargs)
14:00:52   File "/usr/lib/python2.7/site-packages/botocore/client.py", line 492, in _make_api_call
14:00:52     raise ClientError(parsed_response, operation_name)
14:00:52 botocore.exceptions.ClientError: An error occurred (RequestLimitExceeded) when calling the DescribeSecurityGroups operation: Request limit exceeded.

I had used script for creating bulk of security group and I met RequestLimitExceeded Exception. I don’t see any probably workaround for result this issue, because I don’t have any built in function to change retry config. (Yes, I can change json, or in some way do something like that:

client = boto3.client('ec2', region_name='us-west-2', config=boto3_config)
client.meta.events._unique_id_handlers['retry-config-ec2']['handler']._checker.__dict__['_max_attempts'] = 20

, or maybe I can create retryhandler with correct retry_config and transfer this object in some constructor, but I did not find this solution). So, is it true that botocore does not provide any supported and built-in methods for change retries count variable or delay base value?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:25
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

53reactions
adubkovcommented, Oct 24, 2017

I’m using this way. Inspired by botocore unit tests code:

from botocore.config import Config

config = Config(
    retries = dict(
        max_attempts = 10
    )
)

ec2 = boto3.client('ec2', config=config)
4reactions
spstarrcommented, May 23, 2017
Read more comments on GitHub >

github_iconTop Results From Across the Web

Legacy retry mode - Boto3 Docs 1.26.34 documentation - AWS
Legacy mode is the default mode used by any Boto3 client you create. As its name implies, legacy mode uses an older (v1)...
Read more >
python - moto mocking sts to get account id throwing error ...
running on moto with version '0.4.25' on python 2.7, i get the ... -1.x.249.0/build/lib/python2.7/site-packages/botocore/data/_retry.json ...
Read more >
AWS CLI, AWS SDKのリトライ処理の実装について
Retry. AWS CLI, AWS SDKのリトライ処理について、API実行時は、エクスポネンシャル ... boto2.num_retries equivalent in retryhandler.py or _retry.json · Issue ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found