Master deck parsing with 20+ layouts requires ~44 LLM calls. At 60s per call with gemini-3.1-pro = 44-60 minutes total. Previous 30 min timeout caused failures at layout 19/22. Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
36 lines
1.3 KiB
Python
36 lines
1.3 KiB
Python
"""ARQ worker entry point.
|
|
|
|
Run with: python -m arq workers.main.WorkerSettings
|
|
"""
|
|
import os
|
|
|
|
from arq.connections import RedisSettings
|
|
from arq.cron import cron
|
|
|
|
# Import all SQL models so SQLAlchemy can resolve FK references
|
|
from models.sql.user import UserModel # noqa: F401
|
|
from models.sql.client import ClientModel # noqa: F401
|
|
from models.sql.team import TeamModel # noqa: F401
|
|
from models.sql.presentation import PresentationModel # noqa: F401
|
|
|
|
from workers.master_deck_worker import parse_master_deck_task
|
|
from workers.presentation_worker import generate_presentation_task
|
|
from workers.retention_worker import retention_cleanup_task, retention_purge_task
|
|
|
|
|
|
def _get_redis_settings() -> RedisSettings:
|
|
url = os.environ.get("REDIS_URL", "redis://localhost:6379/0")
|
|
return RedisSettings.from_dsn(url)
|
|
|
|
|
|
class WorkerSettings:
|
|
redis_settings = _get_redis_settings()
|
|
functions = [generate_presentation_task, parse_master_deck_task]
|
|
cron_jobs = [
|
|
cron(retention_cleanup_task, hour=2, minute=0), # Daily at 2:00 AM
|
|
cron(retention_purge_task, weekday=0, hour=3, minute=0), # Weekly Monday 3:00 AM
|
|
]
|
|
max_jobs = 5
|
|
job_timeout = 5400 # 90 minutes (master deck with 20+ layouts = ~44 LLM calls)
|
|
max_tries = 3
|
|
health_check_interval = 30
|