[Python] how can celery execute a periodic task immediately?

Discussão em 'Python' iniciado por Stack, Dezembro 8, 2024.

  1. Stack

    Stack Membro Participativo

    I want to use celery to execute a periodic task.
    According to the documentation: http://docs.celeryproject.org/en/latest/userguide/periodic-tasks.html#entries, I wrote down the following code:

    app.conf.beat_schedule = {
    'test_celery': {
    'task': 'tasks.login.test_timertask',
    'schedule': 60.0,
    }
    }


    but when I run it as follows:

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


    the first task is executed after 60s.
    I want to start the task once the worker starts rather than with 60 seconds delay. What should I do?

    Continue reading...

Compartilhe esta Página