InferenceAI

Enter at least two characters to search.

Start free

Circuit Breaker Decisions

mediumProduction AI20 min25 XP

Return a state after each result. Start closed; open when consecutive failures reach threshold; a success resets failures and closes.

Examples

EXAMPLE WALKTHROUGHopens and resets

A guided view of the published example, not a trace of your code.

INPUT[[false,false,true],2]
TASKcircuit_states()
EXPECTED OUTPUT["closed","open","closed"]

Start with the input values shown in this example.

Example 1 of 2

Input: results = [false,false,true], threshold = 2

Output: ["closed","open","closed"]

Explanation: opens and resets

Input: results = [true], threshold = 2

Output: ["closed"]

Explanation: success

Hint 1

Track consecutive failures.

Topics

PythonProduction AI