我正在使用 supervisor 来守护我的 django 项目。如果我不是从主管开始芹菜,而是从壳开始(celery -A proj worker --app=proj.celery:app --loglevel=INFO)
一切正常。当我守护芹菜程序时,任务日志No such file or directory
并立即完成。
没有别的问题,工人还活着,芹菜supervisorctl
地位RUNNING
等等,有什么问题?
我的celery_err.log
文件内容:
[2018-04-08 15:24:01,121: INFO/MainProcess] Connected to redis://localhost:6379//
[2018-04-08 15:24:01,131: INFO/MainProcess] mingle: searching for neighbors
[2018-04-08 15:24:02,135: INFO/MainProcess] mingle: all alone
[2018-04-08 15:24:02,143: WARNING/MainProcess] /home/ali/Desktop/proj/projenv/local/lib/python2.7/site-packages/celery/fixups/django.py:265: UserWarning: Using settings.DEBUG leads to a memory leak, never use this setting in production environments!
warnings.warn('Using settings.DEBUG leads to a memory leak, never '
[2018-04-08 15:24:02,143: WARNING/MainProcess] celery@debian ready.
[2018-04-08 15:24:32,789: INFO/MainProcess] Received task: task_proj[441f7326-c847-4a29-a65d-543b8794e7a3]
[2018-04-08 15:24:32,797: INFO/Worker-2] task_proj[441f7326-c847-4a29-a65d-543b8794e7a3]: Sent scan request successfully
[2018-04-08 15:24:32,831: WARNING/Worker-2] [Errno 2] No such file or directory
[2018-04-08 15:24:32,843: WARNING/Worker-2] [Errno 2] No such file or directory
我的supervisord.conf
文件内容:
[program:proj]
environment=LANG=en_US.UTF-8,LC_ALL=en_US.UTF-8 ,PATH="/var/www/proj/projenv/bin", PROJ_ENV_FILE="/var/www/proj/proj.env",VIRTUAL_ENV="/var/www/proj/projenv",PYTHONPATH="/var/www/proj/projenv/lib/python:/var/www/proj/projenv/lib/python/site-packages"
command = /var/www/proj/bin/gunicorn_start
user = root
redirect_stderr = true
stdout_logfile=/var/www/proj/logs/django.log
stderr_logfile=/var/www/proj/logs/django_err.log
[program:redis]
command = /etc/redis-4.0.2/src/redis-server
[program:celery]
environment=LANG=en_US.UTF-8,LC_ALL=en_US.UTF-8 ,PATH="/var/www/proj/projenv/bin", PROJ_ENV_FILE="/var/www/proj/proj.env",VIRTUAL_ENV="/var/www/proj/projenv",PYTHONPATH="/var/www/proj/projenv/lib/python:/var/www/proj/projenv/lib/python/site-packages"
directory=/var/www/proj/proj
command = /var/www/proj/projenv/bin/celery -A proj worker --app=proj.celery:app --loglevel=INFO
user = root
redirect_stderr = true
stdout_logfile = /var/www/proj/logs/celery.log
stderr_logfile = /var/www/proj/logs/celery_err.log
autostart=true
autorestart=true
startsecs=10
stopwaitsecs=600
Celery 程序目录应指向项目的根目录,而不是基本应用程序。所以与其directory=/var/www/proj/proj
,不如directory=/var/www/proj
。