fer0m
fer0m

Reputation: 244

Periodic task celery every world minute

The celery tasks stops every minute, but the countdown starts from the time when I start the celery. Can I create a periodic task that will be executed every minute of time (like on a clock) and not related to when I started the task.

@app.on_after_configure.connect
    def setup_periodic_tasks(sender, **kwargs):
    sender.add_periodic_task(60.0, do_something.s(), expires=10)

Now it work like this, I'am started celery on 10:10:24 (H:M:S):

do_something - 10:11:24
do_something - 10:12:24
do_something - 10:13:24
do_something - 10:14:24
...

But I want to see

do_something - 10:11:00
do_something - 10:12:00
do_something - 10:13:00
do_something - 10:14:00
...

exactly at 00. Can I do that with easy way? Thank you!

Upvotes: 0

Views: 1582

Answers (1)

iklinac
iklinac

Reputation: 15738

Use crontab schedule

If you want more control over when the task is executed, for example, a particular time of day or day of the week, you can use the crontab schedule type

Upvotes: 1

Related Questions