mirror of
https://github.com/django-q2/django-q2.git
synced 2026-09-15 13:37:56 +08:00
Adding sphinx builds to Travis
* added default module django_q * set build mode to nit-picky * warnings raise errors Want to make sure the docs are neat and build on Travis , to make it easier to accept doc pull requests
This commit is contained in:
@@ -19,7 +19,7 @@ install:
|
||||
|
||||
script:
|
||||
- coverage run --source=django_q -m py.test
|
||||
- sphinx-build -nW -c docs/conf.py
|
||||
- sphinx-build -b html -d docs/_build/doctrees -nW docs docs/_build/html
|
||||
|
||||
after_success:
|
||||
- coveralls
|
||||
|
||||
@@ -5,8 +5,9 @@ myPath = os.path.dirname(os.path.abspath(__file__))
|
||||
sys.path.insert(0, myPath)
|
||||
|
||||
from .tasks import async, schedule, result, fetch
|
||||
from .models import Task, Schedule
|
||||
from .models import Task, Schedule, Success, Failure
|
||||
from .cluster import Cluster
|
||||
|
||||
VERSION = (0, 3, 3)
|
||||
VERSION = (0, 3, 4)
|
||||
|
||||
default_app_config = 'django_q.apps.DjangoQConfig'
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#
|
||||
|
||||
# You can set these variables from the command line.
|
||||
SPHINXOPTS =
|
||||
SPHINXOPTS = -nW
|
||||
SPHINXBUILD = sphinx-build
|
||||
PAPER =
|
||||
BUILDDIR = _build
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
.. _admin_page:
|
||||
.. py:currentmodule:: django_q
|
||||
|
||||
Admin pages
|
||||
===========
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
|
||||
Cluster
|
||||
=======
|
||||
.. py:currentmodule:: django_q
|
||||
|
||||
Django Q uses Python's multiprocessing module to manage a pool of workers that will handle your tasks.
|
||||
Start your cluster using Django's `manage.py` command::
|
||||
|
||||
@@ -46,7 +48,7 @@ You can have multiple clusters on multiple machines, working on the same queue a
|
||||
|
||||
- They connect to the same Redis server.
|
||||
- They use the same cluster name. See :ref:`configuration`
|
||||
- They share the same :const:`SECRET_KEY`
|
||||
- They share the same `SECRET_KEY`
|
||||
|
||||
Using a Procfile
|
||||
----------------
|
||||
@@ -111,7 +113,7 @@ Scheduler
|
||||
Once a minute the scheduler checks for any scheduled task that should be starting.
|
||||
|
||||
- Creates a task from the schedule
|
||||
- Subtracts 1 from :attr:`Schedule.repeats`
|
||||
- Subtracts 1 from :attr:`django_q.Schedule.repeats`
|
||||
- Sets the next run time if there are repeats left or if its negative.
|
||||
|
||||
.. _stop_procedure:
|
||||
@@ -162,7 +164,7 @@ Reference
|
||||
|
||||
.. py:attribute:: sentinel
|
||||
|
||||
returns the :class:`multiprocessing.Process` containing the :class:`Sentinel`.
|
||||
returns the :class:`multiprocessing.Process` containing the :ref:`sentinel`.
|
||||
|
||||
.. py:attribute:: timeout
|
||||
|
||||
@@ -170,11 +172,11 @@ Reference
|
||||
|
||||
.. py:attribute:: start_event
|
||||
|
||||
A :class:`multiprocessing.Event` indicating if the :class:`Sentinel` has finished starting the cluster
|
||||
A :class:`multiprocessing.Event` indicating if the :ref:`sentinel` has finished starting the cluster
|
||||
|
||||
.. py:attribute:: stop_event
|
||||
|
||||
A :class:`multiprocessing.Event` used to instruct the :class:`Sentinel` to initiate the :ref:`stop_procedure`
|
||||
A :class:`multiprocessing.Event` used to instruct the :ref:`sentinel` to initiate the :ref:`stop_procedure`
|
||||
|
||||
.. py:attribute:: is_starting
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ author = 'Ilan Steemers'
|
||||
# The short X.Y version.
|
||||
version = '0.3'
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '0.3.3'
|
||||
release = '0.3.4'
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
@@ -100,7 +100,7 @@ exclude_patterns = ['_build']
|
||||
|
||||
# If true, the current module name will be prepended to all description
|
||||
# unit titles (such as .. function::).
|
||||
# add_module_names = True
|
||||
add_module_names = False
|
||||
|
||||
# If true, sectionauthor and moduleauthor directives will be shown in the
|
||||
# output. They are ignored by default.
|
||||
|
||||
@@ -6,7 +6,7 @@ Installation
|
||||
$ pip install django-q
|
||||
|
||||
|
||||
- Add :mod:`django_q` to :const:`INSTALLED_APPS` in your projects :file:`settings.py`::
|
||||
- Add :mod:`django_q` to `INSTALLED_APPS` in your projects :file:`settings.py`::
|
||||
|
||||
INSTALLED_APPS = (
|
||||
# other apps
|
||||
@@ -25,7 +25,7 @@ Installation
|
||||
Configuration
|
||||
-------------
|
||||
|
||||
Configuration is handled via the :const:`Q_ClUSTER` dictionary in your :file:`settings.py`
|
||||
Configuration is handled via the `Q_ClUSTER` dictionary in your :file:`settings.py`
|
||||
|
||||
.. code:: python
|
||||
|
||||
@@ -130,7 +130,7 @@ of the cache connection you want to use::
|
||||
|
||||
|
||||
.. tip::
|
||||
Django Q uses your :const:`SECRET_KEY` to encrypt task packages and prevent task crossover. So make sure you have it set up in your Django settings.
|
||||
Django Q uses your `SECRET_KEY` to encrypt task packages and prevent task crossover. So make sure you have it set up in your Django settings.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
@@ -166,3 +166,5 @@ Django Q is tested for Python 2.7 and 3.4
|
||||
$ pip install hiredis
|
||||
|
||||
This C library maintained by the core Redis team is faster than the standard PythonParser during high loads.
|
||||
|
||||
.. py:module:: django_q
|
||||
@@ -1,5 +1,6 @@
|
||||
Monitor
|
||||
=======
|
||||
.. py:currentmodule::django_q.monitor
|
||||
|
||||
The cluster monitor shows information about all the Q clusters connected to your project.
|
||||
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
Schedules
|
||||
=========
|
||||
.. py:currentmodule:: django_q
|
||||
|
||||
Schedule
|
||||
--------
|
||||
|
||||
Schedules are regular Django models. You can manage them through the :ref:`admin_page` or directly from your code with the :func:`schedule` function or the :class:`Schedule` model:
|
||||
Schedules are regular Django models.
|
||||
You can manage them through the :ref:`admin_page` or directly from your code with the :func:`schedule` function or the :class:`Schedule` model:
|
||||
|
||||
.. code:: python
|
||||
|
||||
from django_q import Schedule, schedule
|
||||
|
||||
# Use the schedule wrapper
|
||||
|
||||
schedule('math.copysign',
|
||||
2, -2,
|
||||
hook='hooks.print_result',
|
||||
schedule_type=Schedule.DAILY)
|
||||
|
||||
# Or create the object directly
|
||||
|
||||
Schedule.objects.create(func='math.copysign',
|
||||
hook='hooks.print_result',
|
||||
args='2,-2',
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
Tasks
|
||||
=====
|
||||
.. py:currentmodule:: django_q
|
||||
|
||||
Async
|
||||
-----
|
||||
|
||||
Use :func:`async` from your code to quickly offload tasks to the :mod:`cluster`:
|
||||
Use :func:`async` from your code to quickly offload tasks to the :class:`Cluster`:
|
||||
|
||||
.. code:: python
|
||||
|
||||
@@ -83,9 +84,9 @@ Reference
|
||||
|
||||
:param func: The task function to execute
|
||||
:param args: The arguments for the task function
|
||||
:type func: str or object
|
||||
:type func: object
|
||||
:param hook: Optional function to call after execution
|
||||
:type hook: str or object
|
||||
:type hook: object
|
||||
:param bool sync: If set to True, async will simulate a task execution
|
||||
:param redis: Optional redis connection
|
||||
:param kwargs: Keyword arguments for the task function
|
||||
|
||||
Reference in New Issue
Block a user