部分1
我已经阅读并尝试了多个SO线程来使用Redis清除celery任务,但它们都没有起作用。请告诉我如何使用Redis作为代理程序在Celery中清除任务。
部分2
此外,我有多个队列。我可以在项目目录中运行它,但是在守护进程化时,工作人员不会接受任务。我仍然需要手动启动celery工作人员。如何将其守护化?
这是我的celerd配置。
# Name of nodes to start, here we have a single node
CELERYD_NODES="w1 w2 w3 w4"
CELERY_BIN="/usr/local/bin/celery"
# Where to chdir at start.
CELERYD_CHDIR="/var/www/fractal/parser-quicklook/"
# Python interpreter from environment, if using virtualenv
#ENV_PYTHON="/somewhere/.virtualenvs/MyProject/bin/python"
# How to call "manage.py celeryd_multi"
#CELERYD_MULTI="/usr/local/bin/celeryd-multi"
# How to call "manage.py celeryctl"
#CELERYCTL="/usr/local/bin/celeryctl"
#CELERYBEAT="/usr/local/bin/celerybeat"
# Extra arguments to celeryd
CELERYD_OPTS="--time-limit=300 --concurrency=8 -Q BBC,BGR,FASTCOMPANY,Firstpost,Guardian,IBNLIVE,LIVEMINT,Mashable,NDTV,Pandodaily,Reuters,TNW,TheHindu,ZEENEWS "
# Name of the celery config module, don't change this.
CELERY_CONFIG_MODULE="celeryconfig"
# %n will be replaced with the nodename.
CELERYD_LOG_FILE="/var/log/celery/%n.log"
CELERYD_PID_FILE="/var/run/celery/%n.pid"
# Workers should run as an unprivileged user.
#CELERYD_USER="nobody"
#CELERYD_GROUP="nobody"
# Set any other env vars here too!
PROJET_ENV="PRODUCTION"
# Name of the projects settings module.
# in this case is just settings and not the full path because it will change the dir to
# the project folder first.
CELERY_CREATE_DIRS=1
Celeryconfig已经在part1中提供。
这是我的项目目录结构。
project
|-- main.py
|-- project
| |-- celeryconfig.py
| |-- __init__.py
|-- tasks.py
如何使用队列进行守护进程? 我已经在CELERYD_OPTS
中提供了队列。
有没有一种方法可以动态地将celery队列数量设置为守护进程?例如:我们有CELERY_CREATE_MISSING_QUEUES = True
用于创建缺失的队列。是否有类似的方法来守护celery队列?
sudo service celeryd status
时,它显示“celeryd未运行(无pidfile)”。我该如何解决? - Praful Bagai