15 lines
482 B
Python
15 lines
482 B
Python
from celery_app import celery_app
|
|
from flask_app.general.通义千问long import qianwen_long
|
|
|
|
|
|
@celery_app.task(
|
|
name='tasks.process_qianwen_long',
|
|
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:
|
|
# 如果发生异常,重试任务
|
|
raise self.retry(exc=exc, countdown=60) # 60 秒后重试 |