kaskada.health.health_check_watcher

Module Contents

Classes

HealthCheckWatcher

An implementation of a thread to poll the HealthCheckServicer for the overall status. This implementation is thread-safe.

Attributes

logger

logger[source]
class HealthCheckWatcher(health_servicer, interval_seconds=1)[source]

Bases: threading.Thread

An implementation of a thread to poll the HealthCheckServicer for the overall status. This implementation is thread-safe.

Parameters:
run()[source]

Starts the thread to continuously poll the provided HealthCheckServicer for the health of the services. To stop the watcher, use the thread-safe stop() method. This thread is designed to infinitely run until the stop() method is called.

stop()[source]

Stops the HealthCheckWatcher. This method acquires a mutex lock to signal the thread to stop and therefore the thread is not stopped instantly.

get_status()[source]

Gets the status polled from the watcher. This method does not fetch the latest status but reads the latest fetched value between intervals.

Returns:

the latest aggregated health status from the HealthCheckServicer.

Return type:

health_pb2.HealthCheckResponse.ServingStatus