gpt4 book ai didi

django - Celery 和 Celerybeat 正在运行,但不运行任务

转载 作者:可可西里 更新时间:2023-11-01 11:23:54 25 4
gpt4 key购买 nike

我已经在本地服务器上检查了我的代码,我确信我的代码一切正常。所以服务器配置似乎有问题。我有一个 linux 服务器(Ubuntu 16.04)并安装了 nginx、redis ……我还为 celery 和 celerybeat 创建了配置文件,如下所示:

  • /etc/init.d/celeryd
  • /etc/default/celeryd
  • /etc/init.d/celerybeat
  • /etc/default/celerybeat

我检查了它们的状态,它们都在运行,但是当我检查 beat.log 时,它什么也没做,只显示“正在启动...”

celery 文件:

# Names of nodes to start
CELERYD_NODES="worker"

# Absolute or relative path to the 'celery' command:
CELERY_BIN="/home/amirali/AwesomeApp/awesome_env/bin/celery"


# App instance to use
CELERY_APP="AwesomeApp"


# Where to chdir at start. Where your manage.py is...
CELERYD_CHDIR="/home/amirali/AwesomeApp"

# Extra command-line arguments to the worker
CELERYD_OPTS="--time-limit=300 -Ofair --concurrency=8"

# Set logging level to DEBUG
CELERYD_LOG_LEVEL="INFO"

# %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

celerybeat 文件:

  File: /etc/default/celerybeat                                                                                                                                                              
CELERYBEAT_LOG_LEVEL="info"
# Absolute or relative path to the 'celery' command:
CELERY_BIN="/home/amirali/AwesomeApp/awesome_env/bin/celery"

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

# Where to chdir at start.
CELERYBEAT_CHDIR="/home/amirali/AwesomeApp"

# Extra arguments to celerybeat
CELERYBEAT_OPTS="--schedule=/var/run/celery/celerybeat-schedule"
export DJANGO_SETTINGS_MODULE="AwesomeApp.settings"

最佳答案

当我们不得不执行 celery 周期性任务时,结果 celery-beat 没有正常工作,它只是在某个时刻停止了启动任务。

经过一些测试,我们决定不再浪费时间在它上面,而是依赖 linux crontab 实用程序

关于django - Celery 和 Celerybeat 正在运行,但不运行任务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54462403/

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