Merge pull request #298 from Balletie/master

Add option for acknowledging failed tasks (globally and per-task)
This commit is contained in:
Ilan Steemers
2018-03-13 15:24:31 +01:00
committed by GitHub
7 changed files with 82 additions and 8 deletions
+3 -1
View File
@@ -20,7 +20,7 @@ from django_q.queues import Queue
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')
opt_keys = ('hook', 'group', 'save', 'sync', 'cached', 'ack_failure', 'iter_count', 'iter_cached', 'chain', 'broker')
q_options = keywords.pop('q_options', {})
# get an id
tag = uuid()
@@ -42,6 +42,8 @@ def async(func, *args, **kwargs):
task['cached'] = Conf.CACHED
if 'sync' not in task and Conf.SYNC:
task['sync'] = Conf.SYNC
if 'ack_failure' not in task and Conf.ACK_FAILURES:
task['ack_failure'] = Conf.ACK_FAILURES
# finalize
task['kwargs'] = keywords
task['started'] = timezone.now()