07e3d1e026
- Migration 054: worker_configs table (queue_name PK, max/min_concurrency,
enabled, updated_at); seeds step_processing(8/2), thumbnail_rendering(1/1),
ai_validation(4/1)
- WorkerConfig SQLAlchemy model
- apply_worker_concurrency beat task: reads enabled configs, broadcasts
pool_grow to all Celery workers every 5min
- GET/PUT /api/worker/configs (admin): list + update per-queue concurrency
- docker-compose.yml: worker uses --autoscale=${MAX_CONCURRENCY:-8},${MIN_CONCURRENCY:-2};
render-worker uses --autoscale=1,1 --concurrency=1
- WorkerManagement.tsx: "Concurrency Settings" section with +/- steppers
and Save button per queue
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
15 lines
659 B
Python
15 lines
659 B
Python
from datetime import datetime
|
|
from sqlalchemy import String, Integer, Boolean, DateTime
|
|
from sqlalchemy.orm import Mapped, mapped_column
|
|
from app.database import Base
|
|
|
|
|
|
class WorkerConfig(Base):
|
|
__tablename__ = "worker_configs"
|
|
|
|
queue_name: Mapped[str] = mapped_column(String(100), primary_key=True)
|
|
max_concurrency: Mapped[int] = mapped_column(Integer, nullable=False, default=8)
|
|
min_concurrency: Mapped[int] = mapped_column(Integer, nullable=False, default=2)
|
|
enabled: Mapped[bool] = mapped_column(Boolean, nullable=False, default=True)
|
|
updated_at: Mapped[datetime] = mapped_column(DateTime, nullable=False, default=datetime.utcnow)
|