mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-05 23:18:11 +08:00
getting docs ready for 0.2.0
This commit is contained in:
+2
-2
@@ -64,9 +64,9 @@ author = 'Ilan Steemers'
|
|||||||
# built documents.
|
# built documents.
|
||||||
#
|
#
|
||||||
# The short X.Y version.
|
# The short X.Y version.
|
||||||
version = '0.1.4'
|
version = '0.2.0'
|
||||||
# The full version, including alpha/beta/rc tags.
|
# The full version, including alpha/beta/rc tags.
|
||||||
release = '0.1.4.1'
|
release = '0.2.0'
|
||||||
|
|
||||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||||
# for a list of supported languages.
|
# for a list of supported languages.
|
||||||
|
|||||||
+2
-1
@@ -23,7 +23,8 @@ Features
|
|||||||
- Redis
|
- Redis
|
||||||
- Python 2 and 3
|
- Python 2 and 3
|
||||||
|
|
||||||
Tested with: Python 2.7 & 3.4. Django 1.7.8 & 1.8.2
|
|
||||||
|
Django Q is tested with: Python 2.7 & 3.4. Django 1.7.8 & 1.8.2
|
||||||
|
|
||||||
Contents:
|
Contents:
|
||||||
|
|
||||||
|
|||||||
+49
-2
@@ -30,10 +30,57 @@ Schedules are regular Django models. You can manage them through the :ref:`admin
|
|||||||
:param str func: the function to schedule. Dotted strings only.
|
:param str func: the function to schedule. Dotted strings only.
|
||||||
:param args: arguments for the scheduled function.
|
:param args: arguments for the scheduled function.
|
||||||
: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, (H)ourly, (D)aily, (W)eekly, (M)onthly, (Q)uarterly, (Y)early
|
:param str schedule_type: (O)nce, (H)ourly, (D)aily, (W)eekly, (M)onthly, (Q)uarterly, (Y)early or :attr:`Schedule.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 kwargs: optional keyword arguments for the scheduled function.
|
:param kwargs: optional keyword arguments for the scheduled function.
|
||||||
|
|
||||||
.. py:class:: Schedule
|
.. class:: Schedule
|
||||||
|
|
||||||
|
A database model for task schedules.
|
||||||
|
|
||||||
|
.. py:attribute:: func
|
||||||
|
|
||||||
|
The function to be scheduled
|
||||||
|
|
||||||
|
.. py:attribute:: hook
|
||||||
|
|
||||||
|
Optional hook function to be called after execution.
|
||||||
|
|
||||||
|
.. py:attribute:: args
|
||||||
|
|
||||||
|
Positional arguments for the function.
|
||||||
|
|
||||||
|
.. py:attribute:: kwargs
|
||||||
|
|
||||||
|
Keyword arguments for the function
|
||||||
|
|
||||||
|
.. py:attribute:: schedule_type
|
||||||
|
|
||||||
|
The type of schedule. Follows :attr:`Schedule.TYPE`
|
||||||
|
|
||||||
|
.. py:attribute:: TYPE
|
||||||
|
|
||||||
|
`ONCE`, `HOURLY`, `DAILY`, `WEEKLY`, `MONTHLY`. `QUARTERLY`, `YEARLY`
|
||||||
|
|
||||||
|
.. py:attribute:: repeats
|
||||||
|
|
||||||
|
Number of times to repeat schedule. `-1`=Always, `0`=Never, `n` =n.
|
||||||
|
|
||||||
|
|
||||||
|
.. py:attribute:: next_run
|
||||||
|
|
||||||
|
Datetime of the next scheduled execution.
|
||||||
|
|
||||||
|
.. py:attribute:: task
|
||||||
|
|
||||||
|
Name of the last task generated by this schedule.
|
||||||
|
|
||||||
|
.. py:method:: last_run()
|
||||||
|
|
||||||
|
Admin link to the last executed task.
|
||||||
|
|
||||||
|
.. py:method:: success()
|
||||||
|
|
||||||
|
Returns the success status of the last executed task.
|
||||||
|
|
||||||
|
|||||||
+56
-1
@@ -56,8 +56,63 @@ Use :py:func:`async` from your code to quickly offload tasks to the py:module:`
|
|||||||
:rtype: Task
|
:rtype: Task
|
||||||
|
|
||||||
.. versionchanged:: 0.2.0
|
.. versionchanged:: 0.2.0
|
||||||
Renamed from get_task
|
|
||||||
|
Renamed from get_task
|
||||||
|
|
||||||
.. py:class:: Task
|
.. py:class:: Task
|
||||||
|
|
||||||
Database model describing an executed task
|
Database model describing an executed task
|
||||||
|
|
||||||
|
.. py:attribute:: name
|
||||||
|
|
||||||
|
The name of the task
|
||||||
|
|
||||||
|
.. py:attribute:: func
|
||||||
|
|
||||||
|
The function or reference that was executed
|
||||||
|
|
||||||
|
.. py:attribute:: hook
|
||||||
|
|
||||||
|
|
||||||
|
The function to call after execution.
|
||||||
|
|
||||||
|
.. py:attribute:: args
|
||||||
|
|
||||||
|
Positional arguments for the function.
|
||||||
|
|
||||||
|
.. py:attribute:: kwargs
|
||||||
|
|
||||||
|
|
||||||
|
Keyword arguments for the function.
|
||||||
|
|
||||||
|
.. py:attribute:: result
|
||||||
|
|
||||||
|
The result object. Contains the error if any occur.
|
||||||
|
|
||||||
|
.. py:attribute:: started
|
||||||
|
|
||||||
|
The moment the task was picked up by a worker
|
||||||
|
|
||||||
|
.. py:attribute:: stopped
|
||||||
|
|
||||||
|
The moment a worker finished this task
|
||||||
|
|
||||||
|
.. py:attribute:: success
|
||||||
|
|
||||||
|
Was the task executed without problems?
|
||||||
|
|
||||||
|
.. py:method:: time_taken
|
||||||
|
|
||||||
|
Calculates the difference in seconds between started and stopped
|
||||||
|
|
||||||
|
.. py:classmethod:: get_result(task_name)
|
||||||
|
|
||||||
|
Get a result directly by task name
|
||||||
|
|
||||||
|
.. py:class:: Success
|
||||||
|
|
||||||
|
A proxy model of :class:`Task` with the queryset filtered on :attr:`Task.success` is True.
|
||||||
|
|
||||||
|
.. py:class:: Failure
|
||||||
|
|
||||||
|
A proxy model of :class:`Task` with the queryset filtered on :attr:`Task.success` is False.
|
||||||
Reference in New Issue
Block a user