Complete the code to define the state when the circuit breaker stops calls temporarily.
circuit_breaker_state = "[1]"
The open state means the circuit breaker stops calls temporarily to prevent failures.
Complete the code to check if the circuit breaker allows calls in the {{BLANK_1}} state.
if circuit_breaker_state == "[1]": allow_calls = True else: allow_calls = False
The closed state means the circuit breaker allows calls to pass through normally.
Fix the error in the code to transition from open to half-open state after timeout.
if time_since_open > timeout: circuit_breaker_state = "[1]"
After the timeout, the circuit breaker moves to half-open to test if the service has recovered.
Fill both blanks to complete the logic for recording failures and opening the circuit breaker.
failure_count += 1 if failure_count [1] failure_threshold: circuit_breaker_state = "[2]"
When failures reach or exceed the threshold, the circuit breaker moves to open state to stop calls.
Fill all three blanks to complete the dictionary comprehension that tracks service status with circuit breaker states.
service_status = {service: [1] for service, state in services.items() if state [2] "[3]"}This comprehension selects services where the state is open and converts the state to uppercase for status.