本文介绍了如何安排任务在特定时间使用芹菜进行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经研究了 PeriodicTask ,但是这些例子只包括使其重复出现。我正在寻找一些更像codecron 的能力,说每个星期一凌晨1点执行这个任务的一些东西。
I've looked into PeriodicTask, but the examples only cover making it recur. I'm looking for something more like cron's ability to say "execute this task every Monday at 1 a.m."
推荐答案最近发布的版本1.0.3现在支持这一点,谢谢Patrick Altman!
The recently released version 1.0.3 supports this now, thanks to Patrick Altman!
示例:
from celery.task.schedules import crontab from celery.decorators import periodic_task @periodic_task(run_every=crontab(hour=7, minute=30, day_of_week="mon")) def every_monday_morning(): print("This runs every Monday morning at 7:30a.m.")有关更多信息,请参阅更改日志:
See the changelog for more information:
celeryproject/docs/changelog.html
更多推荐
如何安排任务在特定时间使用芹菜进行?
发布评论