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

Method from_string

celery/schedules.py:458–472  ·  view source on GitHub ↗

Create a Crontab from a cron expression string. For example ``crontab.from_string('* * * * *')``. .. code-block:: text ┌───────────── minute (0–59) │ ┌───────────── hour (0–23) │ │ ┌───────────── day of the month (1–31) │ │ │ ┌──────

(cls, crontab: str)

Source from the content-addressed store, hash-verified

456
457 @classmethod
458 def from_string(cls, crontab: str) -> crontab:
459 """
460 Create a Crontab from a cron expression string. For example ``crontab.from_string('* * * * *')``.
461
462 .. code-block:: text
463
464 ┌───────────── minute (0–59)
465 │ ┌───────────── hour (0–23)
466 │ │ ┌───────────── day of the month (1–31)
467 │ │ │ ┌───────────── month (1–12)
468 │ │ │ │ ┌───────────── day of the week (0–6) (Sunday to Saturday)
469 * * * * *
470 """
471 minute, hour, day_of_month, month_of_year, day_of_week = crontab.split(" ")
472 return cls(minute, hour, day_of_week, day_of_month, month_of_year)
473
474 @staticmethod
475 def _expand_cronspec(

Callers 5

test_every_minuteMethod · 0.80
test_once_per_monthMethod · 0.80
_to_remote_tracebackMethod · 0.80

Calls

no outgoing calls

Tested by 4

test_every_minuteMethod · 0.64
test_once_per_monthMethod · 0.64