celery task装饰器能制定某一个队列或者指明routing_key么
from celery.task import task, periodic_task
在periodic_task中可以明确指明routing_key,使用flower查看也确实绑定了,task各种绑不上
#@task(routing_key=settings.LOW_PRIORITY_QUEUE)
@periodic_task(run_every=timedelta(seconds=10), routing_key=settings.LOW_PRIORITY_QUEUE)
def only_a_test():
print 'a simple task'
print settings.LOW_PRIORITY_QUEUE
print '========'
队列配置用了简单的默认值
QUEUE_VARIANT = CONFIG_PREFIX.lower()
CELERY_DEFAULT_EXCHANGE = 'edx.{0}core'.format(QUEUE_VARIANT)
HIGH_PRIORITY_QUEUE = 'edx.{0}core.high'.format(QUEUE_VARIANT)
DEFAULT_PRIORITY_QUEUE = 'edx.{0}core.default'.format(QUEUE_VARIANT)
LOW_PRIORITY_QUEUE = 'edx.{0}core.low'.format(QUEUE_VARIANT)
HIGH_MEM_QUEUE = 'edx.{0}core.high_mem'.format(QUEUE_VARIANT)
CELERY_DEFAULT_QUEUE = DEFAULT_PRIORITY_QUEUE
CELERY_DEFAULT_ROUTING_KEY = DEFAULT_PRIORITY_QUEUE
CELERY_QUEUES = {
HIGH_PRIORITY_QUEUE: {},
LOW_PRIORITY_QUEUE: {},
DEFAULT_PRIORITY_QUEUE: {},
HIGH_MEM_QUEUE: {},
}
celery task装饰器能制定某一个队列或者指明routing_key么?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
能:@task(name='file.file_option_record', routing_key=settings.UPLOAD_RECORD_QUEUE)