当前,我只是将参数传递给函数,以表明我正在将函数作为celery任务运行:
@celery_app.task
def my_task(is_task=False):
if is_task:
# don't wait for group of subtasks to finish
return
else:
# wait for subtasks results
return results
我正在寻找这样的东西:
@celery_app.task
def my_task():
if my_task.called_as_task:
# don't wait for group of subtasks to finish
return
else:
# wait for subtasks results
return results