mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-05 05:48:13 +08:00
Starting rtd docs
This commit is contained in:
+10
-5
@@ -18,6 +18,10 @@ import os
|
|||||||
import shlex
|
import shlex
|
||||||
import alabaster
|
import alabaster
|
||||||
|
|
||||||
|
myPath = os.path.dirname(os.path.abspath(__file__))
|
||||||
|
sys.path.insert(0, myPath + '/../')
|
||||||
|
os.environ['DJANGO_SETTINGS_MODULE'] = 'django_q.tests.settings'
|
||||||
|
|
||||||
# If extensions (or modules to document with autodoc) are in another directory,
|
# If extensions (or modules to document with autodoc) are in another directory,
|
||||||
# add these directories to sys.path here. If the directory is relative to the
|
# add these directories to sys.path here. If the directory is relative to the
|
||||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||||
@@ -34,6 +38,7 @@ import alabaster
|
|||||||
extensions = [
|
extensions = [
|
||||||
'alabaster',
|
'alabaster',
|
||||||
'sphinx.ext.todo',
|
'sphinx.ext.todo',
|
||||||
|
#'sphinx.ext.autodoc'
|
||||||
]
|
]
|
||||||
# Add any paths that contain templates here, relative to this directory.
|
# Add any paths that contain templates here, relative to this directory.
|
||||||
templates_path = ['_templates']
|
templates_path = ['_templates']
|
||||||
@@ -59,16 +64,16 @@ author = 'Ilan Steemers'
|
|||||||
# built documents.
|
# built documents.
|
||||||
#
|
#
|
||||||
# The short X.Y version.
|
# The short X.Y version.
|
||||||
version = '0.1.0'
|
version = '0.1.4'
|
||||||
# The full version, including alpha/beta/rc tags.
|
# The full version, including alpha/beta/rc tags.
|
||||||
release = '0.1.0'
|
release = '0.1.4.1'
|
||||||
|
|
||||||
# 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.
|
||||||
#
|
#
|
||||||
# This is also used if you do content translation via gettext catalogs.
|
# This is also used if you do content translation via gettext catalogs.
|
||||||
# Usually you set "language" from the command line for these cases.
|
# Usually you set "language" from the command line for these cases.
|
||||||
language = None
|
language = 'en'
|
||||||
|
|
||||||
# There are two options for replacing |today|: either, you set today to some
|
# There are two options for replacing |today|: either, you set today to some
|
||||||
# non-false value, then it is used:
|
# non-false value, then it is used:
|
||||||
@@ -116,10 +121,10 @@ html_theme = 'alabaster'
|
|||||||
|
|
||||||
# Theme options are theme-specific and customize the look and feel of a theme
|
# Theme options are theme-specific and customize the look and feel of a theme
|
||||||
# further. For a list of options available for each theme, see the
|
# further. For a list of options available for each theme, see the
|
||||||
# documentation.
|
# documentation.None
|
||||||
html_theme_options = {
|
html_theme_options = {
|
||||||
'description': "A multiprocessing task queue for Django",
|
'description': "A multiprocessing task queue for Django",
|
||||||
'github_user': 'koed00',
|
'github_user': 'Koed00',
|
||||||
'github_repo': 'django-q',
|
'github_repo': 'django-q',
|
||||||
'gittip_user': 'koed00',
|
'gittip_user': 'koed00',
|
||||||
'travis_button': True,
|
'travis_button': True,
|
||||||
|
|||||||
+6
-3
@@ -11,12 +11,15 @@ Contents:
|
|||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 2
|
:maxdepth: 2
|
||||||
|
|
||||||
|
Introduction
|
||||||
|
Installation <install>
|
||||||
|
Usage <usage>
|
||||||
|
Management <management>
|
||||||
|
Admin <admin>
|
||||||
|
Architecture <architecture>
|
||||||
|
|
||||||
|
|
||||||
Indices and tables
|
|
||||||
==================
|
|
||||||
|
|
||||||
* :ref:`genindex`
|
* :ref:`genindex`
|
||||||
* :ref:`modindex`
|
|
||||||
* :ref:`search`
|
* :ref:`search`
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
Management commands
|
||||||
|
===================
|
||||||
|
|
||||||
|
$project offers the following Django management commands
|
||||||
|
|
||||||
|
|
||||||
|
qcluster
|
||||||
|
--------
|
||||||
|
|
||||||
|
.. code:: bash
|
||||||
|
|
||||||
|
python management.py qcluster
|
||||||
|
|
||||||
|
|
||||||
|
qmonitor
|
||||||
|
--------
|
||||||
|
|
||||||
|
.. code:: bash
|
||||||
|
|
||||||
|
python management.py qmonitor
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
Usage
|
||||||
|
=====
|
||||||
|
|
||||||
|
Use :py:func:`async` from your code to quickly offload tasks:
|
||||||
|
|
||||||
|
.. code:: python
|
||||||
|
|
||||||
|
from django_q import async, result
|
||||||
|
|
||||||
|
# create the task
|
||||||
|
async('math.copysign', 2, -2)
|
||||||
|
|
||||||
|
# or with import and storing the id
|
||||||
|
import math.copysign
|
||||||
|
|
||||||
|
task_id = async(copysign, 2, -2)
|
||||||
|
|
||||||
|
# get the result
|
||||||
|
task_result = result(task_id)
|
||||||
|
|
||||||
|
# result returns None if the task has not been executed yet
|
||||||
|
# so in most cases you will want to use a hook:
|
||||||
|
|
||||||
|
async('math.modf', 2.5, hook='hooks.print_result')
|
||||||
|
|
||||||
|
# hooks.py
|
||||||
|
def print_result(task):
|
||||||
|
print(task.result)
|
||||||
|
|
||||||
|
.. py:function:: async(func, *args, [hook=None,] **kwargs)
|
||||||
|
|
||||||
|
Puts a task in the cluster queue
|
||||||
|
|
||||||
|
:param func: The task function to execute
|
||||||
|
:param args: The arguments for the task function
|
||||||
|
:type func: str or object
|
||||||
|
:param hook: Optional function to call after execution
|
||||||
|
:type hook: str or object
|
||||||
|
:param kwargs: Keyword arguments for the task function
|
||||||
|
:returns: The name of the task
|
||||||
|
:rtype: str
|
||||||
|
|
||||||
|
.. py:function:: result(name)
|
||||||
|
|
||||||
|
Gets the result of a previously executed task
|
||||||
|
|
||||||
|
:param str name: the name of the task
|
||||||
|
:returns: The result of the executed task
|
||||||
|
|
||||||
|
.. py:function:: get_task(name)
|
||||||
|
|
||||||
|
Returns a previously executed task
|
||||||
|
|
||||||
|
:param str name: the name of the task
|
||||||
|
:returns: The task
|
||||||
|
:rtype: Task
|
||||||
|
|
||||||
|
|
||||||
|
.. py:class:: Task
|
||||||
|
|
||||||
|
Database model describing an executed task
|
||||||
Reference in New Issue
Block a user