Safety belt for your Python distributed services.
Project description
Safepy (rhymes with safety) 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file safepy-0.1.0a0.tar.gz.
File metadata
- Download URL: safepy-0.1.0a0.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d99abe0ec5a231f6e962ff7793f63f076c8c3d2d35b98b8a3270535b5a2b62e
|
|
| MD5 |
1dbcf83f37f8dcb4002ca912b4ee8396
|
|
| BLAKE2b-256 |
43e03a847f3982b5715a0ca42665cd4b1af357acf1ce8d3d8bab3e7a26952c93
|
File details
Details for the file safepy-0.1.0a0-py3-none-any.whl.
File metadata
- Download URL: safepy-0.1.0a0-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a43d045fec380b8cbe7924ffd7325de672b69d7e3b16c74c7804330b16871f19
|
|
| MD5 |
d922076f7162fbbdbd77ef5fa935eb00
|
|
| BLAKE2b-256 |
5e6f35804cd7530eb8086d61254325781c6e83d5262d8e2f47a441afe1838805
|