开启关闭任务优化
This commit is contained in:
parent
5a25bfe343
commit
1833c1a7ff
|
@ -123,9 +123,11 @@ def close_mtask(opl: Opl):
|
|||
"""
|
||||
from celery.app.control import Control
|
||||
from server.celery import app
|
||||
celery_control = Control(app=app)
|
||||
if opl.mtask_uid:
|
||||
celery_control.revoke(opl.mtask_uid, terminate=True)
|
||||
qs = TaskResult.objects.filter(task_args__contains=opl.id, status__in=['PENDING', 'RECEIVED', 'STARTED'])
|
||||
if qs:
|
||||
celery_control = Control(app=app)
|
||||
for i in qs:
|
||||
celery_control.revoke(i.task_id, terminate=True)
|
||||
opl.mtask_uid = None
|
||||
|
|
Loading…
Reference in New Issue