Skip to main content

health

Health check for all service dependencies.

Checks PostgreSQL, Docling endpoint, Embedding endpoint connectivity, and thread health. Used by Docker HEALTHCHECK and can be run standalone for debugging.

Usage: python -m src.health

Functions

check_postgres

def check_postgres() -> bool

Check PostgreSQL connectivity.

check_docling

def check_docling() -> bool

Check Docling availability (official library).

check_embedding

def check_embedding() -> bool

Check Embedding endpoint availability.

check_thread_health

def check_thread_health() -> tuple[bool, dict]

Check thread health and return thread count information.

Returns: Tuple of (is_healthy, thread_info_dict)

check_health

def check_health(skip_db: bool = False, skip_endpoints: bool = False, skip_threads: bool = False) -> tuple[bool, dict]

Check all dependencies.

Args: skip_db: Skip PostgreSQL check (for endpoint-only verification) skip_endpoints: Skip Docling/Embedding checks (for DB-only verification) skip_threads: Skip thread health check

Returns: Tuple of (is_healthy, health_info_dict)

main

def main() -> int

Main entry point for health check.

Returns: 0 if healthy, 1 otherwise