promptlooper/backend/worker.py
John Lightner 7dad9d97af MAESTRO: Add entrypoint migrations, worker config, and stack integration tests
Create docker/entrypoint.sh to run alembic migrations on API startup.
Create backend/worker.py with Celery app config for the compose worker service.
Fix README single-container port (8000) and add production compose documentation.
Add 27 tests (stack integration + worker) verifying all Docker/compose artifacts
are present, consistent, and the /health endpoint responds correctly.
2026-04-07 02:09:56 -05:00

30 lines
731 B
Python

"""PromptLooper Celery worker configuration."""
from celery import Celery
from config import settings
# Determine broker and backend URLs
broker_url = settings.redis_url or "memory://"
result_backend = settings.redis_url or "cache+memory://"
celery_app = Celery(
"promptlooper",
broker=broker_url,
backend=result_backend,
)
celery_app.conf.update(
task_serializer="json",
accept_content=["json"],
result_serializer="json",
timezone="UTC",
enable_utc=True,
worker_concurrency=settings.max_concurrent_runs,
task_track_started=True,
task_acks_late=True,
worker_prefetch_multiplier=1,
)
# Auto-discover tasks in engine package
celery_app.autodiscover_tasks(["engine"], force=True)