How the Adala Worker Pool architecture works
masterThe Worker Pool is a scalable architecture designed to process AI inference tasks from Label Studio Enterprise (LSE). It uses a 'Competing Consumers' pattern to achieve horizontal scalability and natural load balancing.
Architecture Flow
- Submission: LSE uses the
AdalaClientto call the Adala API (POST /worker-pool/submit-batch). - Distribution: The API publishes work messages to a shared Kafka input topic (
worker_pool_input). - Processing: Multiple Celery workers compete for messages from the input topic. Each worker runs a
WorkerProcessorthat performs AI inference (e.g., using OpenAI or Anthropic). - Result Handling: Workers pass results through an internal async queue to an
OutputProcessor. - Completion: The
OutputProcessorgroups results bymodelrun_idand sends them back to LSE via its API (/api/prompts/{modelrun_id}/batch-predictions).
Key Components
- AdalaClient: The interface located in
label_studio_enterprise.lse_ml_models.adala_clientused to prepare payloads and handle errors. - Celery Workers: Forever-running processes that host both the
WorkerProcessorandOutputProcessorviacelery_integration.py. - Kafka Topics:
worker_pool_input(work distribution) andworker_pool_output(results).