boto3 icon indicating copy to clipboard operation
boto3 copied to clipboard

Make it easier to set metadata_service_num_attempts and metadata_service_timeout programatically

Open sirosen opened this issue 3 years ago • 3 comments

Right now, it's hard to set metadata_service_num_attempts and metadata_service_timeout in application code. Whereas some settings are trivial to set on a per-client basis (e.g. region=...), some require a layer of indirection (e.g. via creating a custom Config object).

However, in the case of these parameters, I think the shortest path to setting these in my application would be something like

def boto3_session(**kwargs):
    botocore_session = botocore.session.get_session()
    botocore_session.set_config_variable('metadata_service_timeout', 5)
    botocore_session.set_config_variable('metadata_service_num_attempts', 2)
    return boto3.session.Session(botocore_session=botocore_session, **kwargs)

This is verbose and awkward for setting something which is supported in config and environment variables. And it requires that all client instantiations use explicit session objects in order to set a config flag.

I think my ideal solution would be for botocore.config.Config to support these settings, and then for the boto3 clients to pass them through the underlying session machinery so that these are supported as part of the retry config.

If these are already supported via Config, then I would claim that the current documentation does not make this sufficiently clear, and ask that we enhance it to cover this usage. (I'm happy to open a PR with sufficient direction about where to update things.) Even if this is something which is considered primarily a botocore issue, I think the boto3 docs should explain how to set these values.

sirosen avatar Aug 26 '20 20:08 sirosen

Thank you for your post. Marking this as feature request.

swetashre avatar Nov 10 '20 20:11 swetashre

Greetings! It looks like this issue hasn’t been active in longer than one year. We encourage you to check if this is still an issue in the latest release. In the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or upvote with a reaction on the initial post to prevent automatic closure. If the issue is already closed, please feel free to open a new one.

github-actions[bot] avatar Mar 25 '22 22:03 github-actions[bot]

The auto-close happening over a 3-day period is a little short, especially as I wasn't working on Friday. Can this be reopened? There's been no activity because I don't want to nag -- I assume the original issue is clear and sufficient.

sirosen avatar Mar 28 '22 12:03 sirosen