orka.orka_start module

OrKa Service Runner (Backward Compatibility Layer)

This module provides backward compatibility for the original OrKa service runner. The actual implementation has been refactored into the orka.startup package for better modularity and maintainability.

Key Features:

  1. Multi-Backend Support: Supports both Redis and Kafka memory backends

  2. Infrastructure Management: Automates the startup and shutdown of required services

  3. Docker Integration: Manages containers via Docker Compose with profiles

  4. Process Management: Starts and monitors the OrKa backend server process

  5. Graceful Shutdown: Ensures clean teardown of services on exit

  6. Path Discovery: Locates configuration files in development and production environments

This module serves as the main entry point for running the complete OrKa service stack. It can be executed directly to start all necessary services:

```bash # Start with Redis backend (default) python -m orka.orka_start

# Start with Kafka backend ORKA_MEMORY_BACKEND=kafka python -m orka.orka_start

# Start with dual backend (both Redis and Kafka) ORKA_MEMORY_BACKEND=dual python -m orka.orka_start ```

Once started, the services will run until interrupted (e.g., Ctrl+C), at which point they will be gracefully shut down.

orka.orka_start.initialize_schema_registry() None[source]

Initialize schema registry by creating a temporary KafkaMemoryLogger. This ensures schemas are registered at startup time.

async orka.orka_start.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.orka_start.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.

orka.orka_start.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