Skip to main content

UNKNOWN

Project description

https://img.shields.io/pypi/v/safepy.svg https://img.shields.io/pypi/l/safepy.svg https://img.shields.io/pypi/pyversions/safepy.svg https://api.shippable.com/projects/587b8d9379509c10004a444b/badge?branch=master https://api.shippable.com/projects/587b8d9379509c10004a444b/coverageBadge?branch=master

Safepy is a latency and fault tolerance library for Python 3.5 (or greater) inspired by Hystrix, Cloud Design Patterns, AWS Architecture Blog and many others.

How to use the library

You can either use the mechanisms as decorators:

from safety import retry

class ProfileService(object):
    @retry(attempts=3, base_delay=1)
    async def get_profile(self, username):
        ...

Or to dynamically recreate protected methods:

from safety import retry

class ProfileService(object):
    def __init__(self):
        self.get_profile = retry(attempts=3, base_delay=1)(
            self.get_profile
        )

    async def get_profile(self, username):
        ...

Retry

from safepy import retry

class ServiceA(object):
    @retry(attempts=3, base_delay=1)
    async def call():
        ...

Notes

  • The default retry is an alias for retry_with_jitter_backoff, a retry mechanism which uses jitter backoff. For exponential backoff use retry_with_exponential_backoff.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

safepy-0.0.1a0-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file safepy-0.0.1a0-py3-none-any.whl.

File metadata

File hashes

Hashes for safepy-0.0.1a0-py3-none-any.whl
Algorithm Hash digest
SHA256 c79658504706c6d1f9a81e2b60f305078687e482fc4edb67cb77d58140a04a0b
MD5 b3fa66b5f226d5f3367a02dd64c507ba
BLAKE2b-256 05cdeb2f3dfe8cb0daa1e593e872a8d5753df9eaef2505f191c97058c2a01310

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page