A
A
Angelex2021-06-11 14:45:49
Django
Angelex, 2021-06-11 14:45:49

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


Here is the supervisor configuration:
[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


Here is the function to set periodic tasks, it is executed at startup:
@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()
    )


But periodic tasks are not executed, there are no errors in the logs, the supervisor logs are also clean. When I call celery -A proj inspect scheduled, I get:
->  [email protected]: OK
    - empty -

1 node online.


The second day I'm fiddling around, I can't understand what's wrong, apparently I missed some trifle, maybe someone came across a similar jamb?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question