mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-02 22:58:12 +08:00
Updated README.
Now only in reST
This commit is contained in:
+36
-22
@@ -13,9 +13,10 @@ Features
|
|||||||
- Encrypted and compressed task packages
|
- Encrypted and compressed task packages
|
||||||
- Scheduled tasks
|
- Scheduled tasks
|
||||||
- Result hooks
|
- Result hooks
|
||||||
- Result and Failure database
|
- Failure and result database
|
||||||
- PaaS compatible with multiple pools
|
- PaaS compatible with multiple instances
|
||||||
- Django Admin
|
- Django Admin integration
|
||||||
|
- Multi cluster monitor
|
||||||
|
|
||||||
Requirements
|
Requirements
|
||||||
~~~~~~~~~~~~
|
~~~~~~~~~~~~
|
||||||
@@ -28,14 +29,14 @@ Requirements
|
|||||||
|
|
||||||
Tested with: Python 2.7, 3.4. Django 1.7.8, 1.8.2\*
|
Tested with: Python 2.7, 3.4. Django 1.7.8, 1.8.2\*
|
||||||
|
|
||||||
\*\ *Django Q is currently in Alpha and as such not safe for production,
|
\*\ *Django Q is currently in Alpha and as such not safe for production,
|
||||||
yet.*
|
yet.*
|
||||||
|
|
||||||
Installation
|
Installation
|
||||||
~~~~~~~~~~~~
|
~~~~~~~~~~~~
|
||||||
|
|
||||||
- Install the latest version with pip: ``pip install django-q``
|
- Install the latest version with pip: ``pip install django-q``
|
||||||
- Add ``django_q`` to ``INSTALLED_APPS`` in your settings.py:
|
- Add `django_q` to `INSTALLED_APPS` in your settings.py:
|
||||||
|
|
||||||
.. code:: python
|
.. code:: python
|
||||||
|
|
||||||
@@ -57,8 +58,8 @@ All configuration settings are optional. e.g:
|
|||||||
|
|
||||||
# settings.py
|
# settings.py
|
||||||
Q_CLUSTER = {
|
Q_CLUSTER = {
|
||||||
'name': 'myproject',
|
'name': 'myproject',
|
||||||
'workers': 8,
|
'workers': 8,
|
||||||
'recycle': 500,
|
'recycle': 500,
|
||||||
'compress': True,
|
'compress': True,
|
||||||
'save_limit': 250,
|
'save_limit': 250,
|
||||||
@@ -69,27 +70,25 @@ All configuration settings are optional. e.g:
|
|||||||
'db': 0, }
|
'db': 0, }
|
||||||
}
|
}
|
||||||
|
|
||||||
- **name** Used to differentiatie between projects using the same Redis
|
- **name** Used to differentiate between projects using the same Redis
|
||||||
server\* *default*: 'default'
|
server\* [*default*: 'default']
|
||||||
|
|
||||||
- **workers** The number of workers to use in the cluster *default*:
|
- **workers** The number of workers to use in the cluster [*default*: CPU count of host]
|
||||||
CPU count of host
|
|
||||||
|
|
||||||
- **recycle** The number of tasks a worker will process before
|
- **recycle** The number of tasks a worker will process before
|
||||||
respawing. Used to release resources. *default*: 500
|
respawning. Used to release resources. [*default*: 500]
|
||||||
|
|
||||||
- **compress** Compress task packages to Redis. Useful for large
|
- **compress** Compress task packages to Redis. Useful for large
|
||||||
payloads. *default*: False
|
payloads. [*default*: False]
|
||||||
|
|
||||||
- **save\_limit** Limits the amount of successful tasks saved to
|
- **save\_limit** Limits the amount of successful tasks saved to
|
||||||
Django. Set to 0 for unlimited. Set to -1 for no success storage at
|
Django. Set to 0 for unlimited. Set to -1 for no success storage at
|
||||||
all. Failures are always saved. *default*: 250
|
all. Failures are always saved. [*default*: 250]
|
||||||
|
|
||||||
- **label** The label used for the Django Admin page *default*: 'Django
|
- **label** The label used for the Django Admin page [*default*: 'Django Q']
|
||||||
Q'
|
|
||||||
|
|
||||||
- **redis** Connection settings for Redis. Follows standard Redis-Py
|
- **redis** Connection settings for Redis. Follows standard Redis-Py
|
||||||
syntax. *default*: localhost
|
syntax. [*default*: localhost]
|
||||||
|
|
||||||
\*\ *Django Q uses your SECRET\_KEY to encrypt task packages and prevent
|
\*\ *Django Q uses your SECRET\_KEY to encrypt task packages and prevent
|
||||||
task crossover*
|
task crossover*
|
||||||
@@ -100,8 +99,12 @@ Managment Commands
|
|||||||
qcluster
|
qcluster
|
||||||
^^^^^^^^
|
^^^^^^^^
|
||||||
|
|
||||||
Start a cluster with: ``python manage.py qcluster`` ####qmonitor Monitor
|
Start a cluster with: ``python manage.py qcluster``
|
||||||
your clusters with ``python manage.py qmonitor``
|
|
||||||
|
qmonitor
|
||||||
|
^^^^^^^^
|
||||||
|
|
||||||
|
Monitor your clusters with ``python manage.py qmonitor``
|
||||||
|
|
||||||
Creating Tasks
|
Creating Tasks
|
||||||
~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~
|
||||||
@@ -109,6 +112,8 @@ Creating Tasks
|
|||||||
Async
|
Async
|
||||||
^^^^^
|
^^^^^
|
||||||
|
|
||||||
|
Use async from your code to quickly offload tasks
|
||||||
|
|
||||||
.. code:: python
|
.. code:: python
|
||||||
|
|
||||||
async(func,*args,hook=None,**kwargs)
|
async(func,*args,hook=None,**kwargs)
|
||||||
@@ -148,9 +153,9 @@ Admin page or in your code:
|
|||||||
from django_q import Schedule
|
from django_q import Schedule
|
||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
Schedule.create(func='math.copysign',
|
Schedule.create(func='math.copysign',
|
||||||
hook='hooks.print_result',
|
hook='hooks.print_result',
|
||||||
args='2,-2',
|
args='2,-2',
|
||||||
schedule_type=Schedule.DAILY,
|
schedule_type=Schedule.DAILY,
|
||||||
next_run=timezone.now())
|
next_run=timezone.now())
|
||||||
|
|
||||||
@@ -162,5 +167,14 @@ Todo
|
|||||||
- Get out of Alpha
|
- Get out of Alpha
|
||||||
- Less dependencies?
|
- Less dependencies?
|
||||||
|
|
||||||
|
Acknowledgements
|
||||||
|
----------------
|
||||||
|
|
||||||
|
- Django Q was inspired by working with
|
||||||
|
`Django-RQ <https://github.com/ui/django-rq>`__ and
|
||||||
|
`RQ <https://github.com/ui/django-rq>`__
|
||||||
|
- Human readable hashes by
|
||||||
|
`HumanHash <https://github.com/zacharyvoase/humanhash>`__
|
||||||
|
|
||||||
.. |image0| image:: https://travis-ci.org/Koed00/django-q.svg?branch=master
|
.. |image0| image:: https://travis-ci.org/Koed00/django-q.svg?branch=master
|
||||||
:target: https://travis-ci.org/Koed00/django-q
|
:target: https://travis-ci.org/Koed00/django-q
|
||||||
|
|||||||
Reference in New Issue
Block a user