- Fix admin sidebar: remove duplicate Teams, add Storage nav item - Analytics: client-scoped queries, super_admin sees all (including NULL client_id) - Storage management: list/download/delete presentations with file metadata - Settings page with brand config router - AI usage tracking: new AIUsageModel, ai_usage_service, analytics endpoint - Master deck → template bridge: _register_as_template creates TemplateModel + PresentationLayoutCodeModel so parsed layouts appear in template picker - Multi-provider LLM vision in parser: Anthropic/Google/OpenAI with asyncio.to_thread - Fix PPTX upload 400: accept by .pptx extension (browser sends octet-stream) - Fix reparse FK violation: presentation_id=None for parse_master_deck jobs - Worker job_timeout increased to 1800s for LLM-heavy master deck parsing - PYTHONUNBUFFERED=1 in docker-compose worker for real-time log output - Auth: clientId in /me response, dev-login cookie improvements - Frontend: auth slice clientId, master-deck thumbnails, storage page Co-Authored-By: Claude Opus 4.6 <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 = 1800 # 30 minutes (master deck parsing with LLM is slow)
|
|
max_tries = 3
|
|
health_check_interval = 30
|