我目前使用"Celeryd"来运行我的Celery工作人员作为守护进程.我的/ etc/default/celeryd文件包含以下内容:
CELERYD_NODES="w1 w2 w3"
Run Code Online (Sandbox Code Playgroud)
这显然开始了三个工人流程.
如何配置路由以使用此配置?例如
celeryd -c 2 -l INFO -Q import
Run Code Online (Sandbox Code Playgroud)
如果我从命令行运行celery,我可以使用-Q标志指定队列.我需要告诉我的w1 worker进程只处理来自"import"队列的任务.
通过在CELERYD_OPTS中提供适当的args,可以使不同的工作者从不同/相同的队列中消耗.
请参阅:http://celery.readthedocs.org/en/latest/reference/celery.bin.multi.html
该链接用于芹菜多文档,但您也可以以相同的方式为您的案例提供参数.
# 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
Run Code Online (Sandbox Code Playgroud)
可以用作:
$ CELERYD_OPTS="--time-limit=300 --concurrency=8 -l INFO -Q:1-3 images,video -Q:4,5 data -Q default -L:4,5 DEBUG"
Run Code Online (Sandbox Code Playgroud)
除非必要,否则不要创建额外的守护进程.
希望这可以帮助.
| 归档时间: |
|
| 查看次数: |
3118 次 |
| 最近记录: |