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.

how to configure retries in code with default configuration

See original GitHub issue

i’d like to configure a client to use an non legacy retry mode, the docs reference doing that via code, but then we don’t get any of the default configuration behavior. ie. if we’re in ec2/ecs container the default would be to load region from the metadata endpoint, but passing an explicit config negates that lookup. applications shouldn’t have to reimplement the metadata server lookups just to get retry configuration options.

ie. on a server in us-east-2

>>> import boto3
>>> client = boto3.client('ec2')
>>> client._endpoint
ec2(https://ec2.us-east-2.amazonaws.com)

# per boto sdk docs on configuring retry
>>> config = Config(retries={'mode': 'adaptive', 'max_attempts': 10})
>>> boto3.client('ec2', config=Config)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ubuntu/lib/python3.8/site-packages/boto3/__init__.py", line 93, in client
    return _get_default_session().client(*args, **kwargs)
  File "/home/ubuntu/lib/python3.8/site-packages/boto3/session.py", line 258, in client
    return self._session.create_client(
  File "/home/ubuntu/lib/python3.8/site-packages/botocore/session.py", line 797, in create_client
    region_name = self._resolve_region_name(region_name, config)
  File "/home/ubuntu/lib/python3.8/site-packages/botocore/session.py", line 848, in _resolve_region_name
    if config and config.region_name is not None:
AttributeError: type object 'Config' has no attribute 'region_name'

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
kapiltcommented, Apr 1, 2021

@tjohanssonn your right this was user error, it does behave as expected wrt to config merge, sorry about the noise. i did end up using the RETRY env variables just to keep things consistent.

0reactions
github-actions[bot]commented, Apr 1, 2021

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

Read more comments on GitHub >

github_iconTop Results From Across the Web

AWS CLI retries - AWS Command Line Interface
To change your retry configuration, update your global AWS configuration file. The default location for your AWS config file is ~/.aws/config.
Read more >
Configurable retry logic configuration file with SqlClient
Learn how to use a configuration file to specify default retry logic providers and customize retry logic options in Microsoft.Data.
Read more >
Legacy retry mode - Boto3 Docs 1.14.0 documentation
The default location for your AWS config file is ~/.aws/config. Here's an example of an AWS config file with the retry configuration options...
Read more >
Configuring Retries | Linkerd
Configure Linkerd to automatically retry failing requests. ... Routes configured in service profiles are different from HTTPRoute resources.
Read more >
Guide to Spring Retry - Baeldung
A quick and practical guide to implementing retry logic with Spring Retry.
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