How to check task status in Celery?

前端 未结 13 898
北荒
北荒 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:49

    You can also create custom states and update it's value duting task execution. This example is from docs:

    @app.task(bind=True)
    def upload_files(self, filenames):
        for i, file in enumerate(filenames):
            if not self.request.called_directly:
                self.update_state(state='PROGRESS',
                    meta={'current': i, 'total': len(filenames)})
    

    http://celery.readthedocs.org/en/latest/userguide/tasks.html#custom-states

    0 讨论(0)
提交回复
热议问题