A circuit breaker implementation for asyncio
Project description
Purgatory is an implementation of the circuit breaker pattern.
Why another Circuit Breaker implementation ?
The Purgatory library has been develop to be used in blacksmith where the library aiobreaker was used but I encountered limitation so, I decide to build my own implementation that feet well with blacksmith.
Features
Purgatory supports the creation of many circuitbreaker easily, and can be used as context manager or decorator.
Example with a context manager
from purgatory import CircuitBreakerFactory circuitbreaker = CircuitBreakerFactory() async with await circuitbreaker.get_breaker("my_circuit"): ...
Example with a decorator
from purgatory import CircuitBreakerFactory circuitbreaker = CircuitBreakerFactory() @circuitbreaker("another circuit") async def function_that_may_fail(): ...
The state of every circuits can be stored in memory, shared in redis, or be completly customized.
It also support monitoring, using event hook.
Purgatory is fully typed and fully tested.
Alternatives
Here is a list of alternatives, which may or may not support coroutines.
aiobreaker - https://pypi.org/project/aiobreaker/
circuitbreaker - https://pypi.org/project/circuitbreaker/
pycircuitbreaker - https://pypi.org/project/pycircuitbreaker/
pybreaker - https://pypi.org/project/pybreaker/
lasier - https://pypi.org/project/lasier/
breakers - https://pypi.org/project/breakers/
pybreaker - https://pypi.org/project/pybreaker/
python-circuit - https://pypi.org/project/python-circuit/
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
Hashes for purgatory-circuitbreaker-0.5.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 087b196f88473364f8d99c27b23113c3a6a84e8b65f1e3d268c587e112d1cac7 |
|
MD5 | 9e6a1d4e98ad47da7fb3302701ac7ce8 |
|
BLAKE2b-256 | bd9a32594689b2b887dddbbc949d0528c80b2161a91db629c3b74c5eea2498c2 |
Hashes for purgatory_circuitbreaker-0.5.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dcea442f75bf8a4e3941ae589c42019dfa0d12f96d77055a8e122f11894ba417 |
|
MD5 | ebf1a783c75fd1e59a88ade7b21f3c32 |
|
BLAKE2b-256 | bcc46baa1713b3accc63e29a813d8d1b52e936da4bef306482af65674cb86595 |