All Projects → linuxdynasty → awsretry

linuxdynasty / awsretry

Licence: other
Decorate your AWS Boto3 Calls with AWSRetry.backoff(). This will allows your calls to get around the AWS Eventual Consistency Errors.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to awsretry

Resty
Simple HTTP and REST client library for Go
Stars: ✭ 5,368 (+12680.95%)
Mutual labels:  retry, backoff
php-backoff
Simple back off / retry functionality
Stars: ✭ 24 (-42.86%)
Mutual labels:  retry, backoff
Backoff
Python library providing function decorators for configurable backoff and retry
Stars: ✭ 1,670 (+3876.19%)
Mutual labels:  retry, backoff
waiter
Delayed iteration for polling and retries.
Stars: ✭ 17 (-59.52%)
Mutual labels:  retry, backoff
backoff
PHP library providing retry functionality with multiple backoff strategies and jitter support
Stars: ✭ 132 (+214.29%)
Mutual labels:  retry, backoff
java-sdk
一些常用的java sdk和工具类(日期工具类,分布式锁,redis缓存,二叉树,反射工具类,线程池,对称/非对称/分段加解密,json序列化,http工具,雪花算法,字符串相似度,集合操作工具,xml解析,重试Retry工具类,Jvm监控等)
Stars: ✭ 26 (-38.1%)
Mutual labels:  retry
pytest-serverless
Automatically mocks resources from serverless.yml in pytest using moto.
Stars: ✭ 26 (-38.1%)
Mutual labels:  boto3
typescript-retry-decorator
lightweight typescript retry decorator with 0 dependency.
Stars: ✭ 50 (+19.05%)
Mutual labels:  retry
invoiceless
Serverless backend for sending simple recurring invoices
Stars: ✭ 44 (+4.76%)
Mutual labels:  boto3
perseverance
Make your functions 💪 resilient and 🚥 fail-fast to 💩 failures or ⌚ delays
Stars: ✭ 12 (-71.43%)
Mutual labels:  retry
retry
Simple and easy retry mechanism package for Go
Stars: ✭ 54 (+28.57%)
Mutual labels:  retry
retryx
Promise-based retry workflow library.
Stars: ✭ 21 (-50%)
Mutual labels:  retry
retrygroup
Package retrygroup provides synchronization, Context cancelation for groups of retry goroutines working on subtasks of a common task.
Stars: ✭ 18 (-57.14%)
Mutual labels:  retry
HTMLTestRunner cn
HTMLTestRunner 汉化版,同时支持python 2和3,增加截图展示功能,失败重试
Stars: ✭ 191 (+354.76%)
Mutual labels:  retry
simple-flask-s3-uploader
Simple and easy to use Flask app to upload files to Amazon S3. Based on Python, Flask, and using Boto3. Securely storing your AWS credentials as environment variables. Quick AWS S3 Flask uploader example.
Stars: ✭ 24 (-42.86%)
Mutual labels:  boto3
re-retrying
A Java library to allow for the creation of configurable retrying strategies for an arbitrary function call, such as something that communicates with a remote service with flaky uptime.
Stars: ✭ 36 (-14.29%)
Mutual labels:  retry
aws-security-test
No description or website provided.
Stars: ✭ 14 (-66.67%)
Mutual labels:  boto3
Word-Prediction-Ngram
Next Word Prediction using n-gram Probabilistic Model with various Smoothing Techniques
Stars: ✭ 25 (-40.48%)
Mutual labels:  backoff
favv
Fullstack Web Application Framework With FastAPI + Vite + VueJS. Streamlit for rapid development.
Stars: ✭ 17 (-59.52%)
Mutual labels:  boto3
export-dynamodb
Export Amazon DynamoDb to CSV or JSON
Stars: ✭ 52 (+23.81%)
Mutual labels:  boto3

AWSRetry - Boto3 Retry/Backoff Decorator

AWSRetry is a Python Decorator that can be used to wrap boto3 function calls. This function was built out of the need to get around a couple of common issues when working with AWS API's.

  • Query API Request Rate
  • Eventual Consistency Model.

Exceptions that will get retried when encountered

  • RequestLimitExceeded
  • Unavailable
  • ServiceUnavailable
  • InternalFailure
  • InternalError
  • ^w+.NotFound

This list can be extended. (http://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html)

Quick Start

Install awsretry.

$ pip install awsretry

I will assume you know about setting up Boto3 Credentials, if not you can read the instructions here http://boto3.readthedocs.io/en/latest/guide/configuration.html

Keyword Arguments that AWSRetry.backoff accepts

  • tries = The number of times to try before giving up. Default = 10
  • delay = The initial delay between retries in seconds. Default = 3
  • backoff = backoff multiplier e.g. value of 2 will double the delay each retry. Default = 1.1
  • added_exceptions = Other exceptions to retry on, beyond the defaults. Default = list()

Examples

Write a quick function that implements AWSRetry.backoff()

#!/usr/bin/env python

import botocore
import boto3
from awsretry import AWSRetry


@AWSRetry.backoff()
def get_instances():
    client = boto3.client('ec2')
    try:
        instances = client.describe_instances()
        return instances
    except botocore.exceptions.ClientError as e:
        raise e

instances = get_instances()

Write a quick function that will overwrite the default arguments.

#!/usr/bin/env python

import botocore
import boto3
from awsretry import AWSRetry


@AWSRetry.backoff(tries=20, delay=2, backoff=1.5, added_exceptions=['ConcurrentTagAccess'])
def create_tags():
    client = boto3.client('ec2')
    try:
        resources = ['1-12345678891234']
        tags = [{'Key': 'service', 'Value': 'web-app'}]
        instances = client.create_tags(Resources=resources, Tags=tags)
    except botocore.exceptions.ClientError as e:
        raise e

create_tags()

Development

Assuming that you have Python and virtualenv installed, set up your environment and install the required dependencies like this instead of the pip install awsretry defined above:

$ git clone https://github.com/linuxdynasty/awsretry.git
$ cd awsretry
$ virtualenv venv
...
$ . venv/bin/activate
$ pip install -r requirements.txt
$ pip install -e .

Running Tests

You can run the tests by using tox which implements nosetest or run them directly using nosetest.

$ tox
$ tox tests/test_awsretry.py
$ tox -e py27,py36 tests/
$ nosetest
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].