芹菜django守护进程中有多个工作人员和多个队列

roh*_*han 5 django daemon celery django-celery celeryd

我正在使用celery-django在我的网站后端排队任务.我正在尝试创建一个设置,其中我有两个名为"低"和"高"的队列和两个工作人员W1和W2.我希望他们以下列方式使用队列中的任务:

W1 < - 低,高

W2 < - 高

通常可以这样做.

打开终端1并输入$celery worker -n W1 -Q low,high

打开终端2并输入$celery worker -n W2 -Q high

但是我试图通过celeryd守护进程做同样的事情.

我按照链接中给出的步骤进行操作:http://celery.readthedocs.org/en/latest/tutorials/daemonizing.html#example-configuration 但可用选项似乎不足以满足要求.

请帮助我一些我不知道哪些可能使它成为可能的配置.我宁愿不运行多个守护进程或使用其他工具,如supervisord,除非真的有必要(也许你可以就此建议我).

dan*_*ula 11

您可以使用CELERYD_OPTS选项传递-Q参数,类似于Celery引用中的示例:

# Advanced example starting 10 workers in the background:
#   * Three of the workers processes the images and video queue
#   * Two of the workers processes the data queue with loglevel DEBUG
#   * the rest processes the default' queue.
$ celery multi start 10 -l INFO -Q:1-3 images,video -Q:4,5 data
    -Q default -L:4,5 DEBUG

# You can show the commands necessary to start the workers with
# the 'show' command:
$ celery multi show 10 -l INFO -Q:1-3 images,video -Q:4,5 data
    -Q default -L:4,5 DEBUG
Run Code Online (Sandbox Code Playgroud)