When using celery to do scheduled tasks, such as the following code
app.conf.beat_schedule = {
# 'login_task': {
# 'task': 'tasks.login.excute_login_task',
# 'schedule': 60*60*20.0,
# },
'test_celery': {
'task': 'tasks.login.test_timertask',
'schedule': 60.0,
}
}
In use
Aftercelery beat -A tasks.login --loglevel=info
, there will be a delay of 60 seconds before executing the first task. I would like to ask, how can I write it so that it can be executed when the scheduled task is first started, and then executed again every 60 seconds?
Simple method: call tasks.login.test_timertask() after or before this
app.conf.beat_schedule = {
}