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."
views:
420answers:
4
+2
A:
Use
YourTask.apply_async(args=[some, args, here], eta=when)
And at the end of your task, reschedule it to the next time it should run.
nosklo
2010-01-02 04:24:01
don't forget eta is a python's datetime,
diegueus9
2010-01-02 04:35:52
If I make it a `PeriodicTask`, I only need to schedule it the first time, right?
Hank Gay
2010-01-02 16:10:10
+2
A:
The recently released version 1.0.3 supports this now, thanks to Patrick Altman!
Example:
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:
asksol
2010-01-22 08:54:04
+1
A:
I have just submitted a patch to add a ScheduledTask to accomplish a small bit of time based scheduling versus period based:
http://github.com/paltman/celery/compare/scheduled-periodic-task
Patrick Altman
2010-05-13 20:54:49