django-q任务队列:失败的任务永远继续处理

sar*_*n3h 1 python django

有人使用 django-q 任务调度程序:https://github.com/Koed00/django-q吗?

(不是数据库相关的Q库)

我有一堆失败的任务。每次我运行 django-q 时,这些失败的任务都会不断弹出:

18:06:14 [Q] INFO Process-1:9 processing [apart-sixteen-butter-friend]
18:06:14 [Q] INFO Process-1:10 processing [single-mississippi-bravo-fillet]
18:06:14 [Q] ERROR Failed [lithium-cola-batman-fanta] - No module named 'shootsta.user'
18:06:14 [Q] INFO Process-1:9 processing [ink-october-angel-california]
18:06:14 [Q] ERROR Failed [zulu-michigan-yankee-kilo] - No module named 'shootsta.user'
18:06:14 [Q] ERROR Failed [four-lemon-arizona-football] - No module named 'shootsta.user'
18:06:14 [Q] ERROR Failed [mississippi-fillet-winner-single] - No module named 'shootsta.user'
18:06:14 [Q] ERROR Failed [west-pennsylvania-asparagus-alabama] - 'BookingAnalytics' object has no attribute 'booking_uid'
18:06:14 [Q] ERROR Failed [wisconsin-pip-alanine-seventeen] - Can't switch from state 'job_complete' using method 'assign_camop'
18:06:14 [Q] ERROR Failed [finch-monkey-moon-oven] - 'AnalyticsFilter' object is not iterable
18:06:14 [Q] ERROR Failed [yellow-west-mango-papa] - 'AnalyticsFilter' object is not iterable
18:06:14 [Q] ERROR Failed [zulu-equal-mississippi-happy] - 'str' object has no attribute 'booking_uid'
18:06:14 [Q] ERROR Failed [six-beer-golf-blue] - 'str' object has no attribute 'booking_uid'
18:06:14 [Q] ERROR Failed [apart-sixteen-butter-friend] - 'str' object has no attribute 'booking_uid'
18:06:14 [Q] ERROR Failed [single-mississippi-bravo-fillet] - 'str' object has no attribute 'booking_uid'
18:06:14 [Q] ERROR Failed [ink-october-angel-california] - 'str' object has no attribute 'booking_uid'
18:06:15 [Q] ERROR reincarnated worker Process-1:4 after death
18:06:15 [Q] INFO Process-1:11 ready for work at 20244
Run Code Online (Sandbox Code Playgroud)

这些失败任务中提到的相关问题已得到修复。然而失败的任务不断出现。即使我从数据库(django_q_task表)中删除失败的条目,每次运行qcluster命令时都会重新创建它们。

我该如何处理这个问题并阻止这些错误出现在输出中?

sur*_*190 5

这是新添加的配置:attempt_count您可以根据此拉取请求将其设置为 1 。

max_attempts不够好而且令人困惑 -因为最小重试次数是 1 - 所以失败任务总共有 2 次调用。

请记住,您还需要设置'ack_failures': True是否Exception引发 - 以确认失败。

令人困惑但有效的是:

Q_CLUSTER = {
    'name': 'DjangORM',
    'workers': 1,
    'timeout': 600,
    'orm': 'default',
    'save_limit': 0,
    'ack_failures': True,
    'max_attempts': 1,
    'attempt_count': 1
}
Run Code Online (Sandbox Code Playgroud)