orka.startup.infrastructure package
Infrastructure Management Package
This package provides infrastructure service management for OrKa including Redis and health monitoring capabilities.
- orka.startup.infrastructure.check_process_health(processes: Dict[str, Popen]) bool [source]
Check the health of all managed processes.
- Parameters:
processes – Dictionary of process name to process object
- Returns:
True if all processes are healthy, False otherwise
- Return type:
bool
- orka.startup.infrastructure.display_error(error: Exception) None [source]
Display error message during startup.
- Parameters:
error – The exception that occurred
- orka.startup.infrastructure.display_service_endpoints(backend: str) None [source]
Display service endpoints for the configured backend.
- Parameters:
backend – The backend type (‘redis’ or ‘redisstack’)
- orka.startup.infrastructure.display_shutdown_complete() None [source]
Display shutdown complete message.
- orka.startup.infrastructure.display_shutdown_message() None [source]
Display graceful shutdown message.
- orka.startup.infrastructure.display_startup_success() None [source]
Display successful startup message.
- async orka.startup.infrastructure.monitor_backend_process(backend_proc: Popen) None [source]
Monitor the backend process and detect if it stops unexpectedly.
- Parameters:
backend_proc – The backend process to monitor
- Raises:
RuntimeError – If the backend process stops unexpectedly
- orka.startup.infrastructure.wait_for_services(backend: str) None [source]
Wait for infrastructure services to be ready.
- Parameters:
backend – The backend type (‘redis’ or ‘redisstack’)
- orka.startup.infrastructure.start_native_redis(port: int = 6380) Popen | None [source]
Start Redis Stack natively on the specified port, with Docker fallback.
- Parameters:
port – Port to start Redis on (default: 6380)
- Returns:
The Redis process, or None if using Docker
- Return type:
subprocess.Popen
- Raises:
RuntimeError – If both native and Docker Redis fail to start
- orka.startup.infrastructure.start_redis_docker(port: int = 6380) Popen | None [source]
Start Redis Stack using Docker as a fallback.
- Parameters:
port – Port to start Redis on
- Returns:
None since Docker process is managed by Docker daemon
- Return type:
Optional[subprocess.Popen]
- Raises:
RuntimeError – If Docker Redis fails to start
- orka.startup.infrastructure.terminate_redis_process(redis_proc: Popen) None [source]
Gracefully terminate a Redis process.
- Parameters:
redis_proc – The Redis process to terminate
- orka.startup.infrastructure.wait_for_redis(port: int, max_attempts: int = 30) None [source]
Wait for Redis to be ready and responsive (works for both native and Docker).
- Parameters:
port – Redis port to check
max_attempts – Maximum number of connection attempts
- Raises:
RuntimeError – If Redis doesn’t become ready within the timeout