orka.startup.orchestrator module

Service Orchestrator

This module handles the main orchestration of OrKa services including startup, monitoring, and shutdown coordination.

orka.startup.orchestrator.start_infrastructure(backend: str) Dict[str, Popen][source]

Start the infrastructure services natively.

Redis will be started as a native process on port 6380. Kafka services will still use Docker when needed.

Parameters:

backend – The backend type (‘redis’, ‘redisstack’, ‘kafka’, or ‘dual’)

Returns:

Dictionary of started processes

Return type:

Dict[str, subprocess.Popen]

Raises:
  • RuntimeError – If Redis Stack is not available or fails to start

  • subprocess.CalledProcessError – If Kafka Docker services fail to start

async orka.startup.orchestrator.main() None[source]

Main entry point for starting and managing OrKa services.

This asynchronous function: 1. Determines which backend to use (Redis, Kafka, or dual) 2. Starts the appropriate infrastructure services (Redis natively, Kafka via Docker) 3. Waits for services to be ready 4. Launches the OrKa backend server 5. Monitors the backend process to ensure it’s running 6. Handles graceful shutdown on keyboard interrupt

The function runs until interrupted (e.g., via Ctrl+C), at which point it cleans up all started processes and containers.

orka.startup.orchestrator.run_startup() None[source]

Run the startup process with proper error handling.

This function serves as the main entry point and handles keyboard interrupts and unexpected errors gracefully.