Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated docs #6

Merged
merged 2 commits into from
Jul 9, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions docs/admin.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,36 @@ Uses the :class:`Failure` proxy model
Scheduled tasks
---------------

Here you can check on the status of your scheduled tasks, create, edit or delete them.

Repeats
~~~~~~~
If you want a schedule to only run a finite amount of times, e.g. every hour for the next 24 hours, you can do that using the :attr:`Schedule.repeats` attribute.
In this case you would set the schedule type to :attr:`Schedule.HOURLY` and the repeats to `24`. Every time the schedule runs the repeats count down until it hits zero and schedule is no longer run.

When you set repeats to `-1` the schedule will continue indefinitely and the repeats will still count down. This can be used as an indicator of how many times the schedule has been executed.

An exception to this are schedules of type :attr:`Schedule.ONCE`. Repeats are ignored by this schedule type and it will always reset it zero after execution.

.. note::

To run a `Once` schedule again, change the repeats to something other than `0`. Set a new run time before you do this or let it execute immediately.

Next run
~~~~~~~~

Shows you when this task will be added to the queue next.


Last run
~~~~~~~~

Links to the task result of the last scheduled run. Shows nothing if the schedule hasn't run yet or if task result has been deleted.

Success
~~~~~~~

Indicates the success status of the last scheduled task, if any.


Uses the :class:`Schedule` model
6 changes: 3 additions & 3 deletions docs/cluster.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ Architecture
Signed Tasks
""""""""""""

Tasks are first pickled and then signed using Django's own
signing module before being sent to a Redis list. This ensures that task

Tasks are first pickled and then signed using Django's own :mod:`django.core.signing` module before being sent to a Redis list. This ensures that task
packages on the Redis server can only be executed and read by clusters
and django servers who share the same secret key.
Optionally the packages can be compressed before transport
Expand Down Expand Up @@ -178,7 +178,7 @@ Reference

.. py:attribute:: is_starting

Bool indicating if the cluster is busy starting up
Bool. Indicating if the cluster is busy starting up

.. py:attribute:: is_running

Expand Down
4 changes: 3 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@
# 'sphinx.ext.autodoc'
]

intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None)}
intersphinx_mapping = {'python': ('https://docs.python.org/3.4', None),
'django': ('https://docs.djangoproject.com/en/1.8/',
'https://docs.djangoproject.com/en/1.8//_objects/')}

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down
49 changes: 43 additions & 6 deletions docs/schedules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,21 @@ Reference
Creates a schedule

:param str func: the function to schedule. Dotted strings only.
:param args: arguments for the scheduled function.
: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 or :attr:`Schedule.TYPE`
:param args: arguments for the scheduled function.
: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 or :attr:`Schedule.TYPE`
: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 kwargs: optional keyword arguments for the scheduled function.
:param datetime next_run: Next or first scheduled execution datetime.
:param kwargs: optional keyword arguments for the scheduled function.

.. class:: Schedule

A database model for task schedules.

.. py:attribute:: id

Primary key

.. py:attribute:: func

The function to be scheduled
Expand All @@ -63,7 +67,7 @@ Reference

.. py:attribute:: TYPE

`ONCE`, `HOURLY`, `DAILY`, `WEEKLY`, `MONTHLY`. `QUARTERLY`, `YEARLY`
:attr:`ONCE`, :attr:`HOURLY`, :attr:`DAILY`, :attr:`WEEKLY`, :attr:`MONTHLY`, :attr:`QUARTERLY`, :attr:`YEARLY`


.. py:attribute:: repeats
Expand All @@ -87,3 +91,36 @@ Reference

Returns the success status of the last executed task.

.. py:attribute:: ONCE

`'O'` the schedule will only run once. Repeats are ignored and set to `0` after execution.

.. py:attribute:: HOURLY

`'H'` the scheduled task will run every hour after its first run.

.. py:attribute:: DAILY

`'D'` the scheduled task will run every day at the time of its first run.

.. py:attribute:: WEEKLY

`'W'` the task will run every week on they day and time of the first run.

.. py:attribute:: MONTHLY

`'M'` the tasks runs every month on they day and time of the last run.

.. note::

Months are tricky. If you schedule something on the 31st of the month and the next month has only 30 days or less, the task will run on the last day of the next month.
It will however continue to run on that day, e.g. the 28th, in subsequent months.

.. py:attribute:: QUARTERLY

`'Q'` this task runs once every 3 months on the day and time of the last run.

.. py:attribute:: YEARLY

`'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.