Files
life-echo/api/app/tasks/evaluation_tasks.py

27 lines
677 B
Python
Raw Normal View History

"""评测实验 Celery 任务。"""
from __future__ import annotations
import asyncio
from celery import shared_task
from app.core.logging import get_logger
logger = get_logger(__name__)
@shared_task(
bind=True,
name="evaluation.run_experiment",
max_retries=1,
soft_time_limit=1800,
time_limit=2400,
)
def run_eval_experiment_task(self, experiment_id: str) -> None:
from app.features.evaluation.execution_service import execute_experiment_full
logger.info("evaluation task start experiment_id={}", experiment_id)
asyncio.run(execute_experiment_full(experiment_id))
logger.info("evaluation task done experiment_id={}", experiment_id)