获取失败的django-celery任务的参数 [英] Getting parameters of a failed django-celery task

查看:104
本文介绍了获取失败的django-celery任务的参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

能否根据给定任务的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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆