mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-05 03:28:11 +08:00
added schedule to README
This commit is contained in:
@@ -31,8 +31,15 @@ You can monitor basic information about all the connected clusters by running `
|
|||||||

|

|
||||||
|
|
||||||
###Admin integration
|
###Admin integration
|
||||||
Django Q registers itself with the admin page to show failed and successful tasks.
|
Django Q registers itself with the admin page to show failed, successful and scheduled tasks.
|
||||||
From there task results can be read or deleted. If necessary, failed tasks can be reintroduced to the queue.
|
From there task results can be read or deleted. If necessary, failed tasks can be reintroduced to the queue.
|
||||||
|
Schedules be created and their results monitored.
|
||||||
|

|
||||||
|
|
||||||
|
###Schedules
|
||||||
|
Scheduled tasks are a django model and can be created through the admin interface or by creating a Schedule instance directly.
|
||||||
|
Like the Async Task, a Schedule can take an optional hook keyword and is used as a template to create the actual task package at the scheduled time.
|
||||||
|
If a result task is available in the database, it can be accessed through the Schedule instance's `result()` method.
|
||||||
|
|
||||||
### Signed Tasks
|
### Signed Tasks
|
||||||
Tasks are first pickled to Json and then signed using Django's own signing module before being sent to a Redis list. This ensures that task packages on the Redis server can only be excuted and read by clusters and django servers who share the same secret key.
|
Tasks are first pickled to Json and then signed using Django's own signing module before being sent to a Redis list. This ensures that task packages on the Redis server can only be excuted and read by clusters and django servers who share the same secret key.
|
||||||
|
|||||||
+15
-3
@@ -53,9 +53,20 @@ running ``./manage.py qmonitor``
|
|||||||
Admin integration
|
Admin integration
|
||||||
~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
Django Q registers itself with the admin page to show failed and
|
Django Q registers itself with the admin page to show failed, successful
|
||||||
successful tasks. From there task results can be read or deleted. If
|
and scheduled tasks. From there task results can be read or deleted. If
|
||||||
necessary, failed tasks can be reintroduced to the queue.
|
necessary, failed tasks can be reintroduced to the queue. Schedules be
|
||||||
|
created and their results monitored. |q admin|
|
||||||
|
|
||||||
|
Schedules
|
||||||
|
~~~~~~~~~
|
||||||
|
|
||||||
|
Scheduled tasks are a django model and can be created through the admin
|
||||||
|
interface or by creating a Schedule instance directly. Like the Async
|
||||||
|
Task, a Schedule can take an optional hook keyword and is used as a
|
||||||
|
template to create the actual task package at the scheduled time. If a
|
||||||
|
result task is available in the database, it can be accessed through the
|
||||||
|
Schedule instance's ``result()`` method.
|
||||||
|
|
||||||
Signed Tasks
|
Signed Tasks
|
||||||
~~~~~~~~~~~~
|
~~~~~~~~~~~~
|
||||||
@@ -119,3 +130,4 @@ I'll add to this README while I'm developing the various parts.
|
|||||||
|
|
||||||
.. |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
|
||||||
|
.. |q admin| image:: http://i.imgur.com/WTZkW9r.png
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
from django_q.models import Task
|
from django_q.models import Task, Schedule
|
||||||
from django_q.core import async
|
from django_q.core import async
|
||||||
|
|
||||||
default_app_config = 'django_q.apps.DjangoQConfig'
|
default_app_config = 'django_q.apps.DjangoQConfig'
|
||||||
|
|||||||
+5
-5
@@ -79,10 +79,10 @@ class Failure(Task):
|
|||||||
|
|
||||||
|
|
||||||
class Schedule(models.Model):
|
class Schedule(models.Model):
|
||||||
func = models.CharField(max_length=256)
|
func = models.CharField(max_length=256, help_text='e.g. module.tasks.function')
|
||||||
hook = models.CharField(max_length=256, null=True, blank=True)
|
hook = models.CharField(max_length=256, null=True, blank=True, help_text='e.g. module.tasks.result_function')
|
||||||
args = models.CharField(max_length=256, null=True, blank=True)
|
args = models.CharField(max_length=256, null=True, blank=True, help_text=_("e.g. 1, 2, 'John'"))
|
||||||
kwargs = models.CharField(max_length=256, null=True, blank=True)
|
kwargs = models.CharField(max_length=256, null=True, blank=True, help_text=_("e.g. x=1, y=2, name='John'"))
|
||||||
ONCE = 'O'
|
ONCE = 'O'
|
||||||
HOURLY = 'H'
|
HOURLY = 'H'
|
||||||
DAILY = 'D'
|
DAILY = 'D'
|
||||||
@@ -100,7 +100,7 @@ class Schedule(models.Model):
|
|||||||
(YEARLY, _('Yearly')),
|
(YEARLY, _('Yearly')),
|
||||||
)
|
)
|
||||||
schedule_type = models.CharField(max_length=1, choices=TYPE, default=TYPE[0][0], verbose_name=_('Schedule Type'))
|
schedule_type = models.CharField(max_length=1, choices=TYPE, default=TYPE[0][0], verbose_name=_('Schedule Type'))
|
||||||
repeats = models.SmallIntegerField(default=-1, verbose_name=_('Repeats'))
|
repeats = models.SmallIntegerField(default=-1, verbose_name=_('Repeats'), help_text=_('n = n times, -1 = forever'))
|
||||||
next_run = models.DateTimeField(verbose_name=_('Next Run'), default=timezone.now, null=True)
|
next_run = models.DateTimeField(verbose_name=_('Next Run'), default=timezone.now, null=True)
|
||||||
task = models.CharField(max_length=100, editable=False, null=True)
|
task = models.CharField(max_length=100, editable=False, null=True)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user