- Celery任务状态
PENDING->STARTED->SUCCESS/FAILD
"STARTED"状态是一个特殊状态,当task_trace_started配置被设置为True或者@task(track_started=True)选项被设置时才会有出现STARTED状态
PENDING”状态实际上并不是一个记录状态,它是任何未知id的任务的默认状态,下面的例子中会出现这一状态:
from proj.celery import app
res=app.AsyncResult('this-id-does-not-exist')
res.state'PENDING'
- cekery key erro 'async'错误解决方法
pip install -U "celery[redis]"
- supervisor配置celery
[program:celery]
command=/usr/local/bin/celery worker -A tasks --loglevel=info
directory={tasks.py文件所在目录}
user=root
numprocs=1
;redirect_stderr=true ; redirect proc stderr to stdout (default false)
stdout_logfile=/var/log/supervisord/celery.log
stderr_logfile=/var/log/supervisord/celery.log
autostart=true
autorestart=true
startsecs=10
stopwaitsecs = 600
killasgroup=true
priority=998
stdout_logfile_maxbytes = 20MB
stdoiut_logfile_backups = 20