I can schedule an hourly task in my Django app using celery beat in settings.py
like so:
CELERYBEAT_SCHEDULE={
'tasks.my_task':{
'task':'tasks.my_task',
'schedule':timedelta(seconds=60*60),
'args':(),
},
}
But is there a way to schedule a task such that it immediately queues up and is calculated, thereafter following the configured schedule from there on? E.g., something like executing a selected task instantly at celery launch. What's the configuration for that?
Add the following to
tasks.py
:This ensures the specified task is run when celery is run. Thereafter, it executes according to schedule.