How to check task status in Celery?

前端 未结 13 983
北荒
北荒 2020-11-28 02:44

How does one check whether a task is running in celery (specifically, I\'m using celery-django)?

I\'ve read the documentation, and I\'ve googled, but I can\'t see a

13条回答
  •  天涯浪人
    2020-11-28 03:32

    Every Task object has a .request property, which contains it AsyncRequest object. Accordingly, the following line gives the state of a Task task:

    task.AsyncResult(task.request.id).state
    

提交回复
热议问题