Files
plantillas-proyectos/backend/core/celery_app.py
2026-02-23 13:05:02 -06:00

39 lines
1.3 KiB
Python

import os
from celery import Celery
# Orden: PedimentoCode y RegimenPedimento antes de CodePedimentoRegimen (mapper)
from api.v1.modules.public.reference_data.pedimento_codes.models import PedimentoCode
from api.v1.modules.public.reference_data.pedimento_regimens.models import RegimenPedimento
from api.v1.modules.public.reference_data.code_pedimento_regimens.models import (
CodePedimentoRegimen,
)
valkey_url = os.getenv("VALKEY_URL", "redis://valkey:6379/0")
celery_app = Celery(
"anexo76_tasks",
broker=valkey_url,
backend=valkey_url,
include=[
"api.v1.modules.a76.reports.importacion.facturas.task",
"api.v1.modules.a76.reports.importacion.consolidados.task",
"api.v1.modules.a76.reports.importacion.packing_list.task",
"api.v1.modules.a76.reports.exportacion.aviso_consolidado.task",
"api.v1.modules.a76.reports.exportacion.descargo.task",
"api.v1.modules.a76.imports.tasks"
] # Ruta al módulo donde están las tareas
)
# Configuraciones adicionales
celery_app.conf.update(
task_track_started=True,
task_serializer="json",
accept_content=["json"],
result_serializer="json",
timezone="America/Mexico_City",
enable_utc=True,
)
if __name__ == "__main__":
celery_app.start()