mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-07 10:28:11 +08:00
Allow different broker on chain (#156)
This commit is contained in:
+2
-2
@@ -569,10 +569,10 @@ class Chain:
|
|||||||
A sequential chain of tasks
|
A sequential chain of tasks
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, chain=None, group=None, cached=Conf.CACHED, sync=Conf.SYNC):
|
def __init__(self, chain=None, group=None, cached=Conf.CACHED, sync=Conf.SYNC, broker=None):
|
||||||
self.chain = chain or []
|
self.chain = chain or []
|
||||||
self.group = group or ""
|
self.group = group or ""
|
||||||
self.broker = get_broker()
|
self.broker = broker or get_broker()
|
||||||
self.cached = cached
|
self.cached = cached
|
||||||
self.sync = sync
|
self.sync = sync
|
||||||
self.started = False
|
self.started = False
|
||||||
|
|||||||
+4
-1
@@ -49,8 +49,9 @@ Reference
|
|||||||
:param str group: an optional group name.
|
:param str group: an optional group name.
|
||||||
:param bool cached: run this against the cache backend
|
:param bool cached: run this against the cache backend
|
||||||
:param bool sync: execute this inline instead of asynchronous
|
:param bool sync: execute this inline instead of asynchronous
|
||||||
|
:param broker: an optional broker instance
|
||||||
|
|
||||||
.. py:class:: Chain(chain=None, group=None, cached=Conf.CACHED, sync=Conf.SYNC)
|
.. py:class:: Chain(chain=None, group=None, cached=Conf.CACHED, sync=Conf.SYNC, broker=None)
|
||||||
|
|
||||||
A sequential chain of tasks. Acts as a convenient wrapper for :func:`async_chain`
|
A sequential chain of tasks. Acts as a convenient wrapper for :func:`async_chain`
|
||||||
You can pass the task chain at construction or you can append individual tasks before running them.
|
You can pass the task chain at construction or you can append individual tasks before running them.
|
||||||
@@ -59,6 +60,8 @@ Reference
|
|||||||
:param str group: an optional group name.
|
:param str group: an optional group name.
|
||||||
:param bool cached: run this against the cache backend
|
:param bool cached: run this against the cache backend
|
||||||
:param bool sync: execute this inline instead of asynchronous
|
:param bool sync: execute this inline instead of asynchronous
|
||||||
|
:param bool sync: execute this inline instead of asynchronous
|
||||||
|
:param broker: an optional broker instance
|
||||||
|
|
||||||
|
|
||||||
.. py:method:: append(func, *args, **kwargs)
|
.. py:method:: append(func, *args, **kwargs)
|
||||||
|
|||||||
Reference in New Issue
Block a user