我杀死了芹菜后,芹菜守护程序停止工作

时间:2020-03-12 09:54:36

标签: python ubuntu celery systemd

我以错误的参数开始工作,这将导致它永远运行。我只是用kill -9杀死了主要的芹菜过程。之后,该服务将无法启动,而我却无法启动。从命令行运行时,它可以正常启动。我正在运行Ubuntu 18.04。日志文件已创建,但具有0个字节。

这是systemctl status celery的输出:

user@ubuntu18-0:~/repository/backend$ systemctl status celery
● celery.service - Celery Service
   Loaded: loaded (/lib/systemd/system/celery.service; disabled; vendor preset: enabled)
   Active: inactive (dead)

Mar 12 09:00:10 ubuntu18-0 sh[5889]: celery multi v4.3.0 (rhubarb)
Mar 12 09:00:10 ubuntu18-0 sh[5889]: > ubuntu18-0@ubuntu18-0: DOWN
Mar 12 09:40:51 ubuntu18-0 systemd[1]: Starting Celery Service...
Mar 12 09:40:54 ubuntu18-0 sh[9234]: 2020-03-12 09:40:54,234 - Asynchronous - INFO - ######################## NEW LOG ########################
Mar 12 09:40:54 ubuntu18-0 sh[9234]: celery multi v4.3.0 (rhubarb)
Mar 12 09:40:54 ubuntu18-0 sh[9234]: > Starting nodes...
Mar 12 09:40:54 ubuntu18-0 sh[9234]:         > ubuntu18-0@ubuntu18-0: OK
Mar 12 09:40:54 ubuntu18-0 systemd[1]: Started Celery Service.
Mar 12 09:40:55 ubuntu18-0 sh[9266]: celery multi v4.3.0 (rhubarb)
Mar 12 09:40:55 ubuntu18-0 sh[9266]: > ubuntu18-0@ubuntu18-0: DOWN
user@ubuntu18-0:~/repository/backend$

以下是手动启动它的输出:

./start_celery.sh
celery multi v4.3.0 (rhubarb)
> Starting nodes...
2020-03-12 09:44:12,459 - Asynchronous - INFO - ######################## NEW LOG ########################
        > ubuntu18-0@ubuntu18-0: OK

这是我的celery.service:

[Unit]
Description=Celery Service
After=network.target

[Service]
Type=forking
EnvironmentFile=/etc/celery.conf
WorkingDirectory=/home/user/repository/backend
ExecStart=/bin/sh -c '${CELERY_BIN} multi start ${CELERYD_NODES} -A ${CELERY_APP} --pidfile=${CELERYD_PID_FILE}  --logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS}'
ExecStop=/bin/sh -c '${CELERY_BIN} multi stopwait ${CELERYD_NODES} --pidfile=${CELERYD_PID_FILE}'
ExecReload=/bin/sh -c '${CELERY_BIN} multi restart ${CELERYD_NODES} -A ${CELERY_APP} --pidfile=${CELERYD_PID_FILE} --logfile=${CELERYD_LOG_FILE} --loglevel=${CELERYD_LOG_LEVEL} ${CELERYD_OPTS}'
Restart=no
#RestartSec=60

[Install]
WantedBy=multi-user.target

这是/etc/celery.conf:

# Names of node, adapt depending on host
CELERYD_NODES="ubuntu18-0"

ENV_PYTHON="/home/user/venv/bin/python3"

# Absolute or relative path to the 'celery' command:
CELERY_BIN="/home/user/venv/bin/celery"

# App instance to use
# comment out this line if you don't use an app
CELERY_APP="asynchronous.async_tasks.celery"

# Where to chdir at start.
CELERYD_CHDIR="/home/user/repository/backend/"

# Extra command-line arguments to the worker
CELERYD_OPTS="--concurrency=4 -Ofair -Q hcs_async,celery"

# Set logging level to DEBUG
CELERYD_LOG_LEVEL="INFO"

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

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

重新启动没有帮助。我怀疑某个地方可能有文件告诉Systemd或celery服务处于某种不良状态。

0 个答案:

没有答案