MCPcopy Create free account
hub / github.com/celery/celery / crontab

Class crontab

celery/schedules.py:354–735  ·  view source on GitHub ↗

Crontab schedule. A Crontab can be used as the ``run_every`` value of a periodic task entry to add :manpage:`crontab(5)`-like scheduling. Like a :manpage:`cron(5)`-job, you can specify units of time of when you'd like the task to execute. It's a reasonably complete implementat

Source from the content-addressed store, hash-verified

352
353
354class crontab(BaseSchedule):
355 """Crontab schedule.
356
357 A Crontab can be used as the ``run_every`` value of a
358 periodic task entry to add :manpage:`crontab(5)`-like scheduling.
359
360 Like a :manpage:`cron(5)`-job, you can specify units of time of when
361 you'd like the task to execute. It's a reasonably complete
362 implementation of :command:`cron`'s features, so it should provide a fair
363 degree of scheduling needs.
364
365 You can specify a minute, an hour, a day of the week, a day of the
366 month, and/or a month in the year in any of the following formats:
367
368 .. attribute:: minute
369
370 - A (list of) integers from 0-59 that represent the minutes of
371 an hour of when execution should occur; or
372 - A string representing a Crontab pattern. This may get pretty
373 advanced, like ``minute='*/15'`` (for every quarter) or
374 ``minute='1,13,30-45,50-59/2'``.
375
376 .. attribute:: hour
377
378 - A (list of) integers from 0-23 that represent the hours of
379 a day of when execution should occur; or
380 - A string representing a Crontab pattern. This may get pretty
381 advanced, like ``hour='*/3'`` (for every three hours) or
382 ``hour='0,8-17/2'`` (at midnight, and every two hours during
383 office hours).
384
385 .. attribute:: day_of_week
386
387 - A (list of) integers from 0-6, where Sunday = 0 and Saturday =
388 6, that represent the days of a week that execution should
389 occur.
390 - A string representing a Crontab pattern. This may get pretty
391 advanced, like ``day_of_week='mon-fri'`` (for weekdays only).
392 (Beware that ``day_of_week='*/2'`` does not literally mean
393 'every two days', but 'every day that is divisible by two'!)
394
395 .. attribute:: day_of_month
396
397 - A (list of) integers from 1-31 that represents the days of the
398 month that execution should occur.
399 - A string representing a Crontab pattern. This may get pretty
400 advanced, such as ``day_of_month='2-30/2'`` (for every even
401 numbered day) or ``day_of_month='1-7,15-21'`` (for the first and
402 third weeks of the month).
403
404 .. attribute:: month_of_year
405
406 - A (list of) integers from 1-12 that represents the months of
407 the year during which execution can occur.
408 - A string representing a Crontab pattern. This may get pretty
409 advanced, such as ``month_of_year='*/3'`` (for the first month
410 of every quarter) or ``month_of_year='2-12/2'`` (for every even
411 numbered month).

Calls

no outgoing calls