Circuit breaker

class ahoyhoy.circuit.Circuit[source]

Simple base class to handle the transition between closed and open circuit states.

class ahoyhoy.circuit.OpenState[source]

Bases: ahoyhoy.circuit.circuit.State

Circut in an open state. Opening as well as all other methods will throw RuntimeError.

class ahoyhoy.circuit.ClosedState[source]

Bases: ahoyhoy.circuit.circuit.State

Circuit in a closed state. Closing will throw RuntimeError.

class ahoyhoy.circuit.circuit.StateClassifier[source]
static classify(circuit, func, *args, **kwargs)[source]

Look at the result, and determine what to do, either with the response or any exceptions raised along the way.

static dispatch(circuit, name)[source]

Return requested function so it can be then called in classify method and proccessed respectively.