Django celery task run at once on startup of celery server

ramusus picture ramusus · Nov 30, 2013 · Viewed 7.1k times · Source

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.

Answer

falsetru picture falsetru · Nov 30, 2013

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):
    ...