1
votes

I'm new to asynchronous tasks and I'm using django-celery and was hoping to use django-celery-beat to schedule periodic tasks.

However it looks like celery-beat doesn't pick up one-off tasks. Do I need two Celery instances, one as a worker for one off tasks and one as beat for scheduled tasks for this to work?

2
There is no need for two separate celery workers for beat to work properly. Can you share the celery, beat settings and config files. - Jijo
Yeah, I know I only need one worker for beat– but I also have a way for users to trigger one-off functions that aren't part of a schedule and are executed. Both can be done from one beat worker? I'm using this command: - aroooo
"celery -A myproject.celery beat -l info --scheduler django_celery_beat.schedulers:DatabaseScheduler" - aroooo
This is what I use for the one off tasks: "celery -A flock.celery worker -l DEBUG -E" @Jijo - aroooo
No need of 2 separate celery instance. Both scheduled and non scheduled task can be executed in one instance. You can specify the queue name while defining the periodic task. - sp1rs

2 Answers

0
votes

Pass -B parameter to your worker, it is a parameter to run beat schedule. This worker will do all other tasks, the ones sent from beat, and the "one-off" ones, it really doesn't matter for worker.

So the full command looks like:

celery -A flock.celery worker -l DEBUG -BE.

-1
votes

If you have multiple periodic tasks executing for example every 10 seconds, then they should all point to the same schedule object. please refer here