Part1
我已经阅读并尝试了各种SO线程来使用Redis清除芹菜任务,但它们都没有工作 . 请让我知道如何使用Redis作为经纪人清除芹菜中的任务 .
Part 2
另外,我有多个队列 . 我可以在项目目录中运行它,但是当妖魔化时,工作人员不接受任务 . 我仍然需要手动启动芹菜 Worker . 我怎么能去除它呢?
这是我的celerd conf .
# 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已在第1部分中提供 .
这是我的proj目录结构 .
project
|-- main.py
|-- project
| |-- celeryconfig.py
| |-- __init__.py
|-- tasks.py
How can I demonize with the Queues? 我也在 CELERYD_OPTS
中提供了队列 .
有没有办法可以动态地妖魔化芹菜中的队列数量?例如: - 我们有 CELERY_CREATE_MISSING_QUEUES = True
用于创建丢失的队列 . 是否有类似于守护芹菜队列的东西?
2 回答
celery purge
应该足以清除redis中的队列 . 但是,您的工作人员将拥有自己的保留任务 and it will send them back to the queue when you stop the worker . 所以,首先,停止所有 Worker . 然后运行celery purge
.如果您有多个队列,
celery purge
将清除默认队列 . 您可以指定要清除的队列: