获取失败的django-celery任务的参数 [英] Getting parameters of a failed django-celery task
问题描述
能否根据给定任务的ID获取用于调用特定失败的芹菜任务的参数?我使用MongoDB作为代理,并使用django-celery软件包。
Is it possible to get the arguments used to call a particular failed celery task given the task's ID? I am using MongoDB as the broker and using the django-celery package.
我知道您可以轻松获得结果,但想知道是否可以执行相同操作
I know that you can get the result pretty easily but wanted to know if you can do the same with the arguments used to call that task.
谢谢
推荐答案
我设法通过为此处指定的任务实现自定义on_failure处理程序来解决此问题:
I managed to solve this problem by implementing a custom on_failure handler for my task as specified here:
http://docs.celeryproject.org/en/latest/userguide/tasks.html#handlers
我得到了带有错误的args信息,并将其保存到数据库中。
I got the args info along with the error and saved it to a database.
这篇关于获取失败的django-celery任务的参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!