我目前使用"Celeryd“将我的芹菜工作进程作为守护进程运行。我的/etc/default/celeryd文件包含以下内容:
CELERYD_NODES="w1 w2 w3"这显然会启动三个工作进程。
如何配置路由以使用此配置?例如:
celeryd -c 2 -l INFO -Q import如果我从命令行运行celery,我可以使用-Q标志指定队列。我需要告诉我的w1工作进程只处理“导入”队列中的任务。
发布于 2014-04-25 20:44:56
您可以通过在CELERYD_OPTS中给出适当的参数,让不同的工作者从不同/相同的队列消费。
参考: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可用作:
$ CELERYD_OPTS="--time-limit=300 --concurrency=8 -l INFO -Q:1-3 images,video -Q:4,5 data -Q default -L:4,5 DEBUG"除非需要,否则不要创建额外的守护程序。
希望这能有所帮助。
发布于 2014-04-24 20:54:00
可以使用名为CELERYD_OPTS的指令添加可选的命令行参数。
# Names of nodes to start
# most will only start one node:
CELERYD_NODES="w1 w2 w3"
# Extra command-line arguments to the worker
CELERYD_OPTS="--time-limit=300 --concurrency=4 -Q import"但据我所知,此选项将告诉所有工作进程将只使用导入队列中的数据。
如果您找不到一个可接受的答案,您可以尝试单独运行workers。
发布于 2016-05-27 04:35:08
值得注意的是,您可以将节点名与CELERYD_OPTS参数一起使用,例如
CELERYD_OPTS="--time-limit=300 --concurrency=4 --concurrency:w3=8 -Q:w1 import"https://stackoverflow.com/questions/23269350
复制相似问题