芹菜不断创建兔子队列,起球全过程 [英] Celery keeps creating rabbitmq queues, pilling all over

查看:271
本文介绍了芹菜不断创建兔子队列,起球全过程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用芹菜(3.1.8 +)与django 1.6
所有任务都被定义为忽略结果(这是正确的语法吗?)

Using celery (3.1.8 + ) with django 1.6 all 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:



19926fa9965e40c19ed9640c2b42ce1e

19926fa9965e40c19ed9640c2b42ce1e


并包含一条消息(类似于以下内容):

and contain one message (similar to the following):


correlation_id:19926fa9-965e-40c1-9ed9-640c2b42ce1e优先级:0
delivery_mode:2标题:content_encoding:binary
CONTENT_TYPE:应用程序/ x-蟒序列化有效负载118个字节
。编码:BASE64
gAJ9cQEoVQZzdGF0dXNxAlUHU1VDQ0VTU3EDVQl0cmFjZWJhY2txBE5VBnJlc3VsdHEFTlUHdGFza19pZHEGVSQxOTkyNmZhOS05NjVlLTQwYzEtOWVkOS02
NDBjMmI0MmNlMWVxB1UIY2hpbGRyZW5xCF11Lg ==

correlation_id: 19926fa9-965e-40c1-9ed9-640c2b42ce1e priority: 0 delivery_mode: 2 headers: content_encoding: binary content_type: application/x-python-serialize Payload 118 bytes Encoding: base64 gAJ9cQEoVQZzdGF0dXNxAlUHU1VDQ0VTU3EDVQl0cmFjZWJhY2txBE5VBnJlc3VsdHEFTlUHdGFza19pZHEGVSQxOTkyNmZhOS05NjVlLTQwYzEtOWVkOS02 NDBjMmI0MmNlMWVxB1UIY2hpbGRyZW5xCF11Lg==

如果我将芹菜设置为永远渴望模式,那么问题解决了,但这显然不是生产服务器的一个很好的解决方案。

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.

这篇关于芹菜不断创建兔子队列,起球全过程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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