如何安排任务在特定时间使用celery执行?

我研究了PeriodicTask,但是示例仅涉及使其重现。我正在寻找一种类似cron的功能,例如说“每个星期一的凌晨1点执行此任务”的功能。

回答:

感谢Patrick Altman,最近发布的1.0.3版现在支持此功能。

例:

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.")

以上是 如何安排任务在特定时间使用celery执行? 的全部内容, 来源链接: utcz.com/qa/425107.html

回到顶部