aiobreaker
aiobreaker is a Python implementation of the Circuit Breaker pattern,
described in Michael T. Nygard's book Release It!_.
Circuit breakers exist to allow one subsystem to fail without destroying the entire system. This is done by wrapping dangerous operations (typically integration points) with a component that can circumvent calls when the system is not healthy.
This project is a fork of pybreaker_ by Daniel Fernandes Martins that
replaces tornado with native asyncio, originally so I could practice
packaging and learn about that shiny new typing package.
.. _Release It!: https://pragprog.com/titles/mnee2/release-it-second-edition/
.. _pybreaker: https://github.com/danielfm/pybreaker
Features
- Configurable list of excluded exceptions (e.g. business exceptions)
- Configurable failure threshold and reset timeout
- Support for several event listeners per circuit breaker
- Can guard generator functions
- Functions and properties for easy monitoring and management
asynciosupport- Optional redis backing
- Synchronous and asynchronous event listeners
Requirements
All you need is python 3.6 or higher.
Installation
To install, simply download from pypi:
.. code:: bash
pip install aiobreaker
Usage
The first step is to create an instance of CircuitBreaker for each
integration point you want to protect against.
.. code:: python
from aiobreaker import CircuitBreaker
# Used in database integration points
db_breaker = CircuitBreaker(fail_max=5, reset_timeout=timedelta(seconds=60))
@db_breaker
async def outside_integration():
"""Hits the api"""
...
At that point, go ahead and get familiar with the documentation.
Metadata
Release files for aiobreaker 1.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| aiobreaker-1.2.0.tar.gz | 15.9 kB | Without provenance | Details for aiobreaker-1.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| aiobreaker-1.2.0-py3-none-any.whl | Python 3 | none | any | Details for aiobreaker-1.2.0-py3-none-any.whl |
Total release size: 36.6 kB
Release files / aiobreaker-1.2.0.tar.gz
| Download URL | aiobreaker-1.2.0.tar.gz |
|---|---|
| Size | 15.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
217a9cfa12e520bb2dd1934bace281d1d7deb8d7630dd183a6295fd22e323ce7
|
|
BLAKE2b-256 checksum How to use checksums |
7feb749ef48d3227fd62d500ff01fcd451f10111e00d822c200eb51782ba076a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4
|
Release files / aiobreaker-1.2.0-py3-none-any.whl
| Download URL | aiobreaker-1.2.0-py3-none-any.whl |
|---|---|
| Size | 20.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f275decad78bdd161715afeee67e5dde7967de54c836648b44f4eea1b5e41d60
|
|
BLAKE2b-256 checksum How to use checksums |
ffc84cd4b2834012ffc71ae3fd69187f08a17f01f3937527b6b5e077f4f5d0db
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.4
|
Security for aiobreaker 1.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.