Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Django celery task run at once on startup of celery server

I need to find how to specify a kind of initial celery task, that will start all other tasks in specially defined way. This initial task should be run immediately at once on celery server startup and never run again.

like image 657
ramusus Avatar asked Nov 30 '13 07:11

ramusus


People also ask

How do I start celery beat Django?

This command has used for start the celery beat. Firstly add the django_celery_beat module in installed apps in settings file. And then apply the django migrate command, this will create the tables in admin pannel. After completing all the process like in celery file and create task in tasks.py .

Does celery run tasks in parallel?

Celery is an asynchronous task queue framework written in Python. Celery makes it easy to execute background tasks but also provides tools for parallel execution and task coordination.


1 Answers

How about using celeryd_after_setup or celeryd_init signal?

Follwing example code from the documentation:

from celery.signals import celeryd_init

@celeryd_init.connect(sender='[email protected]')
def configure_worker12(conf=None, **kwargs):
    ...
like image 120
falsetru Avatar answered Oct 27 '22 20:10

falsetru