To implement a circuit breaker that trips the circuit when the drop rate in a service is higher than a defined parameter. Also implements the immediate restore logic when recovering from a tripped state.
pip install -r /path/to/requirements.txt
- Download the cb module
- Run a redis server instance
redis-server
- Import the circuitBreaker module into your code
from cb.circuitbreaker import circuitBreaker
- Create a circuitBreaker object
cb = circuitBreaker()
- Instead of standard
http requests
, usecb.getReq
orcb.postReq
- Takes care drops and runs restore when needed. Change configs in cb/config.py to customize
- Python
- Flask
- SQLAlchemy
- redis
boto SQSCelery