mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-05 07:08:11 +08:00
Renames async/enqueue to async_task.
This commit is contained in:
+9
-9
@@ -2,16 +2,16 @@
|
||||
|
||||
Chains
|
||||
======
|
||||
Sometimes you want to run tasks sequentially. For that you can use the :func:`enqueue_chain` function:
|
||||
Sometimes you want to run tasks sequentially. For that you can use the :func:`async_chain` function:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# enqueue a chain of tasks
|
||||
from django_q.tasks import enqueue_chain, result_group
|
||||
# async a chain of tasks
|
||||
from django_q.tasks import async_chain, result_group
|
||||
|
||||
# the chain must be in the format
|
||||
# [(func,(args),{kwargs}),(func,(args),{kwargs}),..]
|
||||
group_id = enqueue_chain([('math.copysign', (1, -1)),
|
||||
group_id = async_chain([('math.copysign', (1, -1)),
|
||||
('math.floor', (1,))])
|
||||
|
||||
# get group result
|
||||
@@ -21,7 +21,7 @@ A slightly more convenient way is to use a :class:`Chain` instance:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# Chain enqueue
|
||||
# Chain async
|
||||
from django_q.tasks import Chain
|
||||
|
||||
# create a chain that uses the cache backend
|
||||
@@ -41,9 +41,9 @@ A slightly more convenient way is to use a :class:`Chain` instance:
|
||||
|
||||
Reference
|
||||
---------
|
||||
.. py:function:: enqueue_chain(chain, group=None, cached=Conf.CACHED, sync=Conf.SYNC, broker=None)
|
||||
.. py:function:: async_chain(chain, group=None, cached=Conf.CACHED, sync=Conf.SYNC, broker=None)
|
||||
|
||||
enqueue a chain of tasks. See also the :class:`Chain` class.
|
||||
Async a chain of tasks. See also the :class:`Chain` class.
|
||||
|
||||
:param list chain: a list of tasks in the format [(func,(args),{kwargs}), (func,(args),{kwargs})]
|
||||
:param str group: an optional group name.
|
||||
@@ -52,7 +52,7 @@ Reference
|
||||
|
||||
.. py:class:: Chain(chain=None, group=None, cached=Conf.CACHED, sync=Conf.SYNC)
|
||||
|
||||
A sequential chain of tasks. Acts as a convenient wrapper for :func:`enqueue_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.
|
||||
|
||||
:param list chain: a list of task in the format [(func,(args),{kwargs}), (func,(args),{kwargs})]
|
||||
@@ -63,7 +63,7 @@ Reference
|
||||
|
||||
.. py:method:: append(func, *args, **kwargs)
|
||||
|
||||
Append a task to the chain. Takes the same arguments as :func:`enqueue`
|
||||
Append a task to the chain. Takes the same arguments as :func:`async_task`
|
||||
|
||||
:return: the current number of tasks in the chain
|
||||
:rtype: int
|
||||
|
||||
Reference in New Issue
Block a user