python - How to execute celery scheduled tasks without delay
伊谢尔伦
伊谢尔伦 2017-05-18 10:58:11
0
1
865

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

celery beat -A tasks.login --loglevel=info

After

, 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?

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

reply all(1)
小葫芦

Simple method: call tasks.login.test_timertask() after or before this

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,
}

}

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template