zbparse/flask_app/tasks.py
2024-11-25 17:09:32 +08:00

17 lines
507 B
Python

# flask_app/task
from flask_app.celery_app import celery_app
from flask_app.general.通义千问long import qianwen_long
@celery_app.task(
name='flask_app.task.process_qianwen_long',
bind=True,
soft_time_limit=600, # 10分钟后发出超时信号
time_limit=660
)
def process_qianwen_long(self, file_id, user_query):
try:
return qianwen_long(file_id, user_query)
except Exception as exc:
print("任务发生异常,准备重试")
raise self.retry(exc=exc)