mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-10 06:50:55 +08:00
Adds cron to docs
This commit is contained in:
@@ -180,6 +180,12 @@ Admin page or directly from your code:
|
|||||||
repeats=24,
|
repeats=24,
|
||||||
next_run=arrow.utcnow().replace(hour=18, minute=0))
|
next_run=arrow.utcnow().replace(hour=18, minute=0))
|
||||||
|
|
||||||
|
# Use a cron expression
|
||||||
|
schedule('math.hypot',
|
||||||
|
3, 4,
|
||||||
|
schedule_type=Schedule.CRON,
|
||||||
|
cron = '0 22 * * 1-5')
|
||||||
|
|
||||||
For more info check the `Schedules <https://django-q.readthedocs.org/en/latest/schedules.html>`__ documentation.
|
For more info check the `Schedules <https://django-q.readthedocs.org/en/latest/schedules.html>`__ documentation.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -88,6 +88,13 @@ Optional
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- `Croniter <https://github.com/kiorky/croniter>`__ is an optional package that is used to parse cron expressions for the scheduler::
|
||||||
|
|
||||||
|
$ pip install croniter
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Add-ons
|
Add-ons
|
||||||
-------
|
-------
|
||||||
- `django-q-rollbar <https://github.com/danielwelch/django-q-rollbar>`__ is a Rollbar error reporter::
|
- `django-q-rollbar <https://github.com/danielwelch/django-q-rollbar>`__ is a Rollbar error reporter::
|
||||||
|
|||||||
+20
-2
@@ -45,6 +45,13 @@ You can manage them through the :ref:`admin_page` or directly from your code wit
|
|||||||
repeats=24,
|
repeats=24,
|
||||||
next_run=arrow.utcnow().replace(hour=18, minute=0))
|
next_run=arrow.utcnow().replace(hour=18, minute=0))
|
||||||
|
|
||||||
|
# Use a cron expression
|
||||||
|
schedule('math.hypot',
|
||||||
|
3, 4,
|
||||||
|
schedule_type=Schedule.CRON,
|
||||||
|
cron = '0 22 * * 1-5')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Missed schedules
|
Missed schedules
|
||||||
----------------
|
----------------
|
||||||
@@ -99,8 +106,9 @@ Reference
|
|||||||
:param args: arguments for the scheduled function.
|
:param args: arguments for the scheduled function.
|
||||||
:param str name: An optional name for your schedule.
|
:param str name: An optional name for your schedule.
|
||||||
:param str hook: optional result hook function. Dotted strings only.
|
:param str hook: optional result hook function. Dotted strings only.
|
||||||
:param str schedule_type: (O)nce, M(I)nutes, (H)ourly, (D)aily, (W)eekly, (M)onthly, (Q)uarterly, (Y)early or :attr:`Schedule.TYPE`
|
:param str schedule_type: (O)nce, M(I)nutes, (H)ourly, (D)aily, (W)eekly, (M)onthly, (Q)uarterly, (Y)early or (C)ron :attr:`Schedule.TYPE`
|
||||||
:param int minutes: Number of minutes for the Minutes type.
|
:param int minutes: Number of minutes for the Minutes type.
|
||||||
|
:param str cron: Cron expression for the Cron type.
|
||||||
:param int repeats: Number of times to repeat schedule. -1=Always, 0=Never, n =n.
|
:param int repeats: Number of times to repeat schedule. -1=Always, 0=Never, n =n.
|
||||||
:param datetime next_run: Next or first scheduled execution datetime.
|
:param datetime next_run: Next or first scheduled execution datetime.
|
||||||
:param dict q_options: options passed to async_task for this schedule
|
:param dict q_options: options passed to async_task for this schedule
|
||||||
@@ -140,7 +148,7 @@ Reference
|
|||||||
|
|
||||||
.. py:attribute:: TYPE
|
.. py:attribute:: TYPE
|
||||||
|
|
||||||
:attr:`ONCE`, :attr:`MINUTES`, :attr:`HOURLY`, :attr:`DAILY`, :attr:`WEEKLY`, :attr:`MONTHLY`, :attr:`QUARTERLY`, :attr:`YEARLY`
|
:attr:`ONCE`, :attr:`MINUTES`, :attr:`HOURLY`, :attr:`DAILY`, :attr:`WEEKLY`, :attr:`MONTHLY`, :attr:`QUARTERLY`, :attr:`YEARLY`, :attr:`CRON`
|
||||||
|
|
||||||
|
|
||||||
.. py:attribute:: minutes
|
.. py:attribute:: minutes
|
||||||
@@ -148,6 +156,10 @@ Reference
|
|||||||
The number of minutes the :attr:`MINUTES` schedule should use.
|
The number of minutes the :attr:`MINUTES` schedule should use.
|
||||||
Is ignored for other schedule types.
|
Is ignored for other schedule types.
|
||||||
|
|
||||||
|
.. py:attribute:: cron
|
||||||
|
|
||||||
|
A cron string describing the schedule. You need the optional `croniter` package installed for this.
|
||||||
|
|
||||||
.. py:attribute:: repeats
|
.. py:attribute:: repeats
|
||||||
|
|
||||||
Number of times to repeat the schedule. -1=Always, 0=Never, n =n.
|
Number of times to repeat the schedule. -1=Always, 0=Never, n =n.
|
||||||
@@ -208,3 +220,9 @@ Reference
|
|||||||
|
|
||||||
`'Y'` only runs once a year. The same caution as with months apply;
|
`'Y'` only runs once a year. The same caution as with months apply;
|
||||||
If you set this to february 29th, it will run on february 28th in the following years.
|
If you set this to february 29th, it will run on february 28th in the following years.
|
||||||
|
|
||||||
|
.. py:attribute:: CRON
|
||||||
|
|
||||||
|
`'C'` uses the optional `croniter` package to determine a schedule based a cron expression.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user