每个世界分钟的周期性任务芹菜

Periodic task celery every world minute

celery 任务每分钟停止一次,但从我启动celery 的时间开始倒计时。我可以创建一个周期性任务,该任务将每分钟执行一次(例如在时钟上)并且与我何时开始任务无关。

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

现在它是这样工作的,我在 10:10:24 (H:M:S):

上开始使用 celery
do_something - 10:11:24
do_something - 10:12:24
do_something - 10:13:24
do_something - 10:14:24
...

但是我想看

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

正好在 00。我可以用简单的方法做到这一点吗?谢谢!

使用crontab时间表

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