Skip to content

Commit

Permalink
[AWSBaseActor] Respect boto3/AWS retry configurability (#522)
Browse files Browse the repository at this point in the history
* [AWSBaseActor] Respect boto3/AWS retry configurability

* linter appeasement
  • Loading branch information
LaikaN57 authored Jan 4, 2023
1 parent f7f9514 commit 7c87b46
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion kingpin/actors/aws/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ def __init__(self, *args, **kwargs):
boto_config = botocore_config.Config(
region_name=self.region,
retries={
"mode": "adaptive",
"max_attempts": aws_settings.AWS_MAX_ATTEMPTS,
"mode": aws_settings.AWS_RETRY_MODE,
},
)

Expand Down
9 changes: 9 additions & 0 deletions kingpin/actors/aws/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,12 @@
AWS_ACCESS_KEY_ID = os.getenv("AWS_ACCESS_KEY_ID", None)
AWS_SECRET_ACCESS_KEY = os.getenv("AWS_SECRET_ACCESS_KEY", None)
AWS_SESSION_TOKEN = os.getenv("AWS_SESSION_TOKEN", None)

# kingpin is pretty fast which can leads to API throttling. You can set you own
# boto3 configuration by using the standard AWS env vars, but in the absence of
# them, we try to set you some sane defaults based on the boto3 documentation
# and our experience with running kingpin as scale.
#
# Docs: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/retries.html
AWS_MAX_ATTEMPTS = os.getenv("AWS_MAX_ATTEMPTS", 10)
AWS_RETRY_MODE = os.getenv("AWS_RETRY_MODE", "standard")

0 comments on commit 7c87b46

Please sign in to comment.