mirror of
https://github.com/django-q2/django-q2.git
synced 2026-09-24 13:48:12 +08:00
+2
-1
@@ -166,6 +166,7 @@ class Sentinel(object):
|
||||
:param process: the process to reincarnate
|
||||
:type process: Process or None
|
||||
"""
|
||||
db.connections.close_all() # Close any old connections
|
||||
if process == self.monitor:
|
||||
self.monitor = self.spawn_monitor()
|
||||
logger.error(_("reincarnated monitor {} after sudden death").format(process.name))
|
||||
@@ -529,7 +530,7 @@ def scheduler(broker=None):
|
||||
s.repeats += -1
|
||||
# send it to the cluster
|
||||
q_options['broker'] = broker
|
||||
q_options['group'] = s.name or s.id
|
||||
q_options['group'] = q_options.get('group', s.name or s.id)
|
||||
kwargs['q_options'] = q_options
|
||||
s.task = tasks.async(s.func, *args, **kwargs)
|
||||
# log it
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('django_q', '0007_ormq'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='schedule',
|
||||
name='name',
|
||||
field=models.CharField(blank=True, max_length=100, null=True),
|
||||
),
|
||||
]
|
||||
+1
-1
@@ -121,7 +121,7 @@ class Failure(Task):
|
||||
|
||||
|
||||
class Schedule(models.Model):
|
||||
name = models.CharField(max_length=100, null=True)
|
||||
name = models.CharField(max_length=100, null=True, blank=True)
|
||||
func = models.CharField(max_length=256, help_text='e.g. module.tasks.function')
|
||||
hook = models.CharField(max_length=256, null=True, blank=True, help_text='e.g. module.tasks.result_function')
|
||||
args = models.TextField(null=True, blank=True, help_text=_("e.g. 1, 2, 'John'"))
|
||||
|
||||
+2
-2
@@ -19,12 +19,12 @@ def async(func, *args, **kwargs):
|
||||
"""Queue a task for the cluster."""
|
||||
keywords = kwargs.copy()
|
||||
opt_keys = ('hook', 'group', 'save', 'sync', 'cached', 'iter_count', 'iter_cached', 'chain', 'broker')
|
||||
q_options = keywords.pop('q_options', None)
|
||||
q_options = keywords.pop('q_options', {})
|
||||
# get an id
|
||||
tag = uuid()
|
||||
# build the task package
|
||||
task = {'id': tag[1],
|
||||
'name': tag[0],
|
||||
'name': keywords.pop('task_name', None) or q_options.pop('task_name', None) or tag[0],
|
||||
'func': func,
|
||||
'args': args}
|
||||
# push optionals
|
||||
|
||||
@@ -69,6 +69,11 @@ broker
|
||||
""""""
|
||||
A broker instance, in case you want to control your own connections.
|
||||
|
||||
task_name
|
||||
"""""""""
|
||||
|
||||
Optionally overwrites the auto-generated task name.
|
||||
|
||||
q_options
|
||||
"""""""""
|
||||
None of the option keywords get passed on to the task function.
|
||||
|
||||
+4
-4
@@ -6,8 +6,8 @@
|
||||
#
|
||||
arrow==0.7.0
|
||||
blessed==1.14.1
|
||||
boto3==1.2.3
|
||||
botocore==1.3.23 # via boto3
|
||||
boto3==1.2.5
|
||||
botocore==1.3.30 # via boto3
|
||||
django-picklefield==0.3.2
|
||||
django-redis==4.3.0
|
||||
docutils==0.12 # via botocore
|
||||
@@ -16,11 +16,11 @@ hiredis==0.2.0
|
||||
iron-core==1.2.0 # via iron-mq
|
||||
iron-mq==0.8
|
||||
jmespath==0.9.0 # via boto3, botocore
|
||||
psutil==3.4.2
|
||||
psutil==4.0.0
|
||||
pymongo==3.2.1
|
||||
python-dateutil==2.4.2 # via arrow, botocore, iron-core
|
||||
redis==2.10.5
|
||||
requests==2.9.1 # via iron-core, rollbar
|
||||
rollbar==0.11.2
|
||||
rollbar==0.11.3
|
||||
six==1.10.0 # via blessed, python-dateutil, rollbar
|
||||
wcwidth==0.1.6 # via blessed
|
||||
|
||||
Reference in New Issue
Block a user