gpt4 book ai didi

python - 给 celery 守护进程加花?

转载 作者:太空狗 更新时间:2023-10-30 00:12:57 25 4
gpt4 key购买 nike

是否可以将花添加到 celery 守护进程?

下面是我的 celery 配置文件,我尝试将 flower 配置添加到 CELERYD_OPTS 变量,但失败了。

或者是否有另一个命令我可以添加到配置文件中以使用 celery 启动并运行 flower?

# Names of nodes to start
# most people will only start one node:
CELERYD_NODES="worker1"
# but you can also start multiple and configure settings
# for each in CELERYD_OPTS
#CELERYD_NODES="worker1 worker2 worker3"
# alternatively, you can specify the number of nodes to start:
#CELERYD_NODES=10

# Absolute or relative path to the 'celery' command:
CELERY_BIN="/usr/local/bin/celery"

# App instance to use
# comment out this line if you don't use an app
CELERY_APP="itapp"
# or fully qualified:
#CELERY_APP="proj.tasks:app"

# Where to chdir at start.
CELERYD_CHDIR="/itapp/itapp/"

# Extra command-line arguments to the worker
CELERYD_OPTS="flower --ports 5555 --time-limit=300 --concurrency=8"
# Configure node-specific settings by appending node name to arguments:
#CELERYD_OPTS="--time-limit=300 -c 8 -c:worker2 4 -c:worker3 2 -Ofair:worker1"

# Set logging level to DEBUG
#CELERYD_LOG_LEVEL="DEBUG"

# %n will be replaced with the first part of the nodename.
CELERYD_LOG_FILE="/var/log/celery/%n%I.log"
CELERYD_PID_FILE="/var/run/celery/%n.pid"

# Workers should run as an unprivileged user.
# You need to create this user manually (or you can choose
# a user/group combination that already exists (e.g., nobody).
CELERYD_USER="celery"
CELERYD_GROUP="celery"

# If enabled pid and log directories will be created if missing,
# and owned by the userid/group configured.
CELERY_CREATE_DIRS=1

最佳答案

我建议使用 supervisordother process control system 运行它们,而不是操作系统初始化脚本和启动停止守护进程。

worker 和 flower 都应该作为守护进程并排运行,有 many docs on how to run celery worker with supervisord , run flower 只是简单地增加了一个程序段,将 worker 命令替换为相应的 flower 启动命令,如 celery flower -A itapp --ports 5555 --time-limit=300 --concurrency=8.

关于python - 给 celery 守护进程加花?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46348992/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com