问题描述
使用芹菜(3.1.8 +)与django 1.6
所有任务都被定义为忽略结果(这是正确的语法吗?)
Using celery (3.1.8 + ) with django 1.6all tasks are defined to ignore results (is this the correct syntax?)
@shared_task(ignore_result=True)
def somefunc():
pass
当我看看rabbitmq队列时,我看到越来越多的由芹菜创建的队列,如:
When I look at the rabbitmq queues I see more and more queues created by celery with names like:
并包含一条消息(类似于以下内容):
and contain one message (similar to the following):
如果我将芹菜设置为永远渴望模式,那么问题解决了,但这显然不是生产服务器的一个很好的解决方案。
If I set celery to "always eager" mode then the problem is solved, but this is obviously not a good solution for a production server.
任何线索?这是连接到ignore_result选项吗?在某处有一些缺失的任务?还有其他的?
Any Clues? Is this connected to the ignore_result option? and there is some missing task somewhere? something else?
感谢您的帮助
推荐答案
不知道django或您的代码如何定义 @shared_task
装饰器,但是您是否尝试明确设置其中的队列?
I'm not sure how django or your code defines the @shared_task
decorator, but have you tried explicitly setting the queue within it?
@shared_task(ignore_results=True, queue="myexamplequeue")
每当您调用 .delay()
或 myexamplequeue > .apply_async()在 somefunc
。
This would apply the message to the myexamplequeue
whenever you call .delay()
or .apply_async()
on somefunc
.
这篇关于芹菜不断创建兔子队列,起球全过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!