【问题标题】:adding flower to celery daemon?向芹菜守护进程添加花?
【发布时间】:2017-09-21 16:34:05
【问题描述】:

是否可以在 celery daemon 中添加花?

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

或者我可以在配置文件中添加另一个命令来让花与 celery 一起运行吗?

# 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

【问题讨论】:

  • 我不确定celery_opts 是否意味着启动另一个进程(如果我理解正确,这就是花。即使你确实使用配置得到它,它也可能是错误的。为什么不分别启动两者(您可以创建一个同时启动两者的脚本)?
  • 我需要另一个花的守护进程吗?我不知道该怎么做,我按照本指南为芹菜做这件事pythad.github.io/articles/2016-12/…。我找不到芹菜的
  • 我用谷歌搜索了这个:github.com/mher/flower/issues/28 但也许谷歌如何启动花,因为它是一个单独的进程和服务器。

标签: python celery flower


【解决方案1】:

我建议使用supervisordother process control system 运行它们,而不是操作系统初始化脚本和start-stop-daemon。

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

【讨论】:

  • im 使用 python 3,目前 supervisord 不支持
  • supercisord 将程序作为二进制可执行文件运行,与 python 2 或 3 无关,但是,您可以坚持使用 init,只需将运行花作为独立守护程序的想法。
猜你喜欢
  • 2011-09-26
  • 1970-01-01
  • 2019-12-07
  • 2017-12-14
  • 2016-03-10
  • 2014-11-11
  • 1970-01-01
  • 1970-01-01
  • 2014-05-09
相关资源
最近更新 更多