Added schedule command

* improved schedule tests
 * updated README
  * bumped up to version 0.1.3
This commit is contained in:
Ilan Steemers
2015-06-30 16:38:08 +02:00
parent e9356657e9
commit 4096b35adf
8 changed files with 119 additions and 39 deletions
+26 -3
View File
@@ -88,13 +88,13 @@ All configuration settings are optional. e.g:
- **label** The label used for the Django Admin page *['Django Q']*
- **redis** Connection settings for Redis. Follows standard Redis-Py syntax. *[localhost]*
*[defaults]*
\*\ *Django Q uses your SECRET\_KEY to encrypt task packages and prevent
task crossover*
Management Commands
~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~
qcluster
^^^^^^^^
@@ -150,7 +150,16 @@ Admin page or directly from your code:
.. code:: python
from django_q import Schedule
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',
@@ -158,6 +167,20 @@ Admin page or directly from your code:
schedule_type=Schedule.DAILY
)
Models
~~~~~~
- `Task` and `Schedule` are Django Models and can therefore be managed by your own code.
- `Task` objects are only created after an async package has been executed.
- A `Schedule` creates a new async package for every execution and thus an unique `Task`
- `Success` and `Failure` are convenient proxy models of `Task`
Testing
-------
To run the tests you will need `py.test <http://pytest.org/latest/>`__ and `pytest-django <https://github.com/pytest-dev/pytest-django>`__
Todo
----