mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-02 10:28:11 +08:00
Modified django_q imports to support Python 3.4 again in cluster.py. Closes #315
This commit is contained in:
+4
-4
@@ -21,7 +21,7 @@ from django.utils.translation import ugettext_lazy as _
|
|||||||
from multiprocessing import Event, Process, Value, current_process
|
from multiprocessing import Event, Process, Value, current_process
|
||||||
|
|
||||||
# Local
|
# Local
|
||||||
from django_q import tasks
|
import django_q.tasks
|
||||||
from django_q.brokers import get_broker
|
from django_q.brokers import get_broker
|
||||||
from django_q.conf import Conf, logger, psutil, get_ppid, error_reporter
|
from django_q.conf import Conf, logger, psutil, get_ppid, error_reporter
|
||||||
from django_q.models import Task, Success, Schedule
|
from django_q.models import Task, Success, Schedule
|
||||||
@@ -402,7 +402,7 @@ def save_task(task, broker):
|
|||||||
return
|
return
|
||||||
# enqueues next in a chain
|
# enqueues next in a chain
|
||||||
if task.get('chain', None):
|
if task.get('chain', None):
|
||||||
tasks.async_chain(task['chain'], group=task['group'], cached=task['cached'], sync=task['sync'], broker=broker)
|
django_q.tasks.async_chain(task['chain'], group=task['group'], cached=task['cached'], sync=task['sync'], broker=broker)
|
||||||
# SAVE LIMIT > 0: Prune database, SAVE_LIMIT 0: No pruning
|
# SAVE LIMIT > 0: Prune database, SAVE_LIMIT 0: No pruning
|
||||||
db.close_old_connections()
|
db.close_old_connections()
|
||||||
try:
|
try:
|
||||||
@@ -470,7 +470,7 @@ def save_cached(task, broker):
|
|||||||
broker.cache.set(group_key, group_list, timeout)
|
broker.cache.set(group_key, group_list, timeout)
|
||||||
# async_task next in a chain
|
# async_task next in a chain
|
||||||
if task.get('chain', None):
|
if task.get('chain', None):
|
||||||
tasks.async_chain(task['chain'], group=group, cached=task['cached'], sync=task['sync'], broker=broker)
|
django_q.tasks.async_chain(task['chain'], group=group, cached=task['cached'], sync=task['sync'], broker=broker)
|
||||||
# save the task
|
# save the task
|
||||||
broker.cache.set(task_key,
|
broker.cache.set(task_key,
|
||||||
SignedPackage.dumps(task),
|
SignedPackage.dumps(task),
|
||||||
@@ -531,7 +531,7 @@ def scheduler(broker=None):
|
|||||||
q_options['broker'] = broker
|
q_options['broker'] = broker
|
||||||
q_options['group'] = q_options.get('group', s.name or s.id)
|
q_options['group'] = q_options.get('group', s.name or s.id)
|
||||||
kwargs['q_options'] = q_options
|
kwargs['q_options'] = q_options
|
||||||
s.task = tasks.async_task(s.func, *args, **kwargs)
|
s.task = django_q.tasks.async_task(s.func, *args, **kwargs)
|
||||||
# log it
|
# log it
|
||||||
if not s.task:
|
if not s.task:
|
||||||
logger.error(
|
logger.error(
|
||||||
|
|||||||
Reference in New Issue
Block a user