Files
LegacyHUB/app/workers/tasks.py
Vadim Malanov 7f72171572 chore: bootstrap repository with governance docs
Initialize git, add Apache-2.0 LICENSE, .gitattributes (LF line
endings), AGENTS.md (entry points, stack, discovery order, baseline
checks), RUNBOOK.md (dev boot, prod deploy with overlay, ingestion,
failures, rollback, scaling notes), .env.prod.example with rotated
credential placeholders, and dev-only warnings on .env.example.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 16:41:50 +03:00

23 lines
764 B
Python

"""Celery tasks - thin wrappers over pipeline functions."""
from __future__ import annotations
import uuid
from celery.utils.log import get_task_logger
from app.workers.celery_app import celery_app
logger = get_task_logger(__name__)
@celery_app.task(name="legacyhub.process_document", bind=True, max_retries=2, default_retry_delay=30)
def process_document(self, document_id: str, run_id: str | None = None) -> dict:
from app.ingestion.pipeline import process_document_id
try:
return process_document_id(uuid.UUID(document_id), uuid.UUID(run_id) if run_id else None)
except Exception as exc: # noqa: BLE001
logger.exception("worker.process_failed", extra={"document_id": document_id})
raise self.retry(exc=exc) from exc