Allow different broker on chain (#156)

This commit is contained in:
Stan Triepels
2024-03-02 22:45:40 +01:00
committed by GitHub
parent 88430c9014
commit 782b1de60d
2 changed files with 6 additions and 3 deletions
+2 -2
View File
@@ -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
View File
@@ -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)