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

时间:2019-01-31 14:09:12

标签: django nginx redis celery celerybeat

我已经在本地服务器上检查了我的代码,并且我确定我的代码一切正常。因此,似乎服务器配置有问题。我有一个Linux服务器(Ubuntu 16.04),并安装了Nginx,redis和...,此外,我还为celery和celerybeat创建了配置文件,如下所示:

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

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

celeryd文件:

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

1 个答案:

答案 0 :(得分:0)

当我们不得不执行芹菜定期任务时,事实证明celery-beat不能正常工作,它只是停止了发射任务。

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