Skip to main content

A circuit breaker implementation for asyncio

Project description

Documentation Status Continuous Integration Status Code Coverage Report

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.

Project details


Download files

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

Source Distribution

purgatory-circuitbreaker-0.5.1.tar.gz (10.5 kB view hashes)

Uploaded Source

Built Distribution

purgatory_circuitbreaker-0.5.1-py3-none-any.whl (13.1 kB view hashes)

Uploaded Python 3

Supported by

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