#python #django #redis #celery #supervisord
Вопрос:
Привет, я сделал приложение, в котором я извлекаю данные и отображаю их в режиме реального времени на своем веб-сайте.
На местном уровне он отлично работает, когда я запускаю следующее:
celery -A proj_name beat -l INFO
celery -A proj_name worker -l INFO -p gevent
Я использую gevent, потому что нахожусь в Windows. На сервере Ubuntu я не думаю, что мне это понадобится.
Итак, теперь на сервере я следую приведенной ниже статье дословно:
https://realpython.com/asynchronous-tasks-with-django-and-celery/#running-remotely
Когда я дойду до последней части:
sudo supervisorctl start pichacelery
это дает мне следующую ошибку:
bscscanapicelery: ERROR (no such file)
Это мои файлы:
bscscanapi_celery.conf
; ==================================
; celery worker supervisor example
; ==================================
; the name of your supervisord program
[program:bscscanapicelery]
; Set full path to celery program if using virtualenv
command=/home/djangoadmin/.virtualenvs/bscscanapi/bin/celery worker -A bscscanapi --loglevel=INFO
; The directory to your Django project
directory=/home/djangoadmin/stalker-nichan/bscscanapi
; If supervisord is run as the root user, switch users to this UNIX user account
; before doing any processing.
user=djangoadmin
; Supervisor will start as many instances of this program as named by numprocs
numprocs=1
; Put process stdout output in this file
stdout_logfile=/var/log/celery/bscscanapi_worker.log
; Put process stderr output in this file
stderr_logfile=/var/log/celery/bscscanapi_worker.log
; If true, this program will start automatically when supervisord is started
autostart=true
; May be one of false, unexpected, or true. If false, the process will never
; be autorestarted. If unexpected, the process will be restart when the program
; exits with an exit code that is not one of the exit codes associated with this
; process’ configuration (see exitcodes). If true, the process will be
; unconditionally restarted when it exits, without regard to its exit code.
autorestart=true
; The total number of seconds which the program needs to stay running after
; a startup to consider the start successful.
startsecs=10
; Need to wait for currently executing tasks to finish at shutdown.
; Increase this if you have very long running tasks.
stopwaitsecs = 600
; When resorting to send SIGKILL to the program to terminate it
; send SIGKILL to its whole process group instead,
; taking care of its children as well.
killasgroup=true
; if your broker is supervised, set its priority higher
; so it starts first
priority=998
bscscanapi_celerybeat.conf
; ================================
; celery beat supervisor example
; ================================
; the name of your supervisord program
[program:bscscanapicelerybeat]
; Set full path to celery program if using virtualenv
command=/home/djangoadmin/.virtualenvs/bscscanapi/bin/celery beat -A bscscanapi --loglevel=INFO
; The directory to your Django project
directory=/home/djangoadmin/stalker-nichan/bscscanapi
; If supervisord is run as the root user, switch users to this UNIX user account
; before doing any processing.
user=djangoadmin
; Supervisor will start as many instances of this program as named by numprocs
numprocs=1
; Put process stdout output in this file
stdout_logfile=/var/log/celery/bscscanapi_beat.log
; Put process stderr output in this file
stderr_logfile=/var/log/celery/bscscanapi_beat.log
; If true, this program will start automatically when supervisord is started
autostart=true
; May be one of false, unexpected, or true. If false, the process will never
; be autorestarted. If unexpected, the process will be restart when the program
; exits with an exit code that is not one of the exit codes associated with this
; process’ configuration (see exitcodes). If true, the process will be
; unconditionally restarted when it exits, without regard to its exit code.
autorestart=true
; The total number of seconds which the program needs to stay running after
; a startup to consider the start successful.
startsecs=10
; if your broker is supervised, set its priority higher
; so it starts first
priority=999
Комментарии:
1. Пожалуйста, подтвердите, вы бежите
sudo supervisorctl start pichacelery
илиsudo supervisorctl start bscscanapicelery
…??2. Я запускаю sudo supervisorctl запускаю bscscanapicelery. Подтверждать.