Answer the question
In order to leave comments, you need to log in
What's wrong with the Celery setup, do periodic tasks not work?
On the local machine, periodic tasks were launched, as they began to transfer to the server, they fell off. Perhaps something because of the supervisor. celery itself works, asynchronous tasks are executed, but the scheduler does not execute regular tasks, I tried to run it as a separate worker.
Here is the celery startup script: start_celery.sh
#!/bin/bash
source /home/www/proj/core/venv/bin/activate
exec celery -A proj worker -l INFO -f /home/www/proj/core/logs/celery.tmp.log
-B --scheduler django_celery_beat.schedulers:DatabaseScheduler
[program:celery]
command=/home/www/proj/core/bin/start_celery.sh
directory=/home/www/proj/core
user=www
process_name=%(program_name)s
numprocs=1
autostart=true
autorestart=true
redirect_stderr=true
@celery_app.on_after_finalize.connect
def setup_periodic_tasks(sender: celery_app, **kwargs):
# Устанавливает регулярные задачи
print("setup_periodic_tasks()")
sender.add_periodic_task(
crontab(hour=10),
remind_notify.s()
)
sender.add_periodic_task(
crontab(minute=1),
check_mailings.s()
)
celery -A proj inspect scheduled
, I get:-> [email protected]: OK
- empty -
1 node online.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question