mirror of
https://github.com/django-q2/django-q2.git
synced 2026-10-01 23:18:12 +08:00
Replaces async occurrences with alternatives
* async is now a reserved word in python3.7 * Rename async function to enqueue * Rename all async_ functions to enqueue_ * Rename Async class to AsyncTask * Updates the docs.
This commit is contained in:
+7
-7
@@ -2,15 +2,15 @@
|
||||
|
||||
Groups
|
||||
======
|
||||
You can group together results by passing :func:`async` the optional ``group`` keyword:
|
||||
You can group together results by passing :func:`enqueue` the optional ``group`` keyword:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
# result group example
|
||||
from django_q.tasks import async, result_group
|
||||
from django_q.tasks import enqueue, result_group
|
||||
|
||||
for i in range(4):
|
||||
async('math.modf', i, group='modf')
|
||||
enqueue('math.modf', i, group='modf')
|
||||
|
||||
# wait until the group has 4 results
|
||||
result = result_group('modf', count=4)
|
||||
@@ -66,14 +66,14 @@ You can also access group functions from a task result instance:
|
||||
task.group_delete()
|
||||
print('Deleted group {}'.format(task.group))
|
||||
|
||||
or call them directly on :class:`Async` object:
|
||||
or call them directly on :class:`AsyncTask` object:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
from django_q.tasks import Async
|
||||
from django_q.tasks import enqueue
|
||||
|
||||
# add a task to the math group and run it cached
|
||||
a = Async('math.floor', 2.5, group='math', cached=True)
|
||||
a = enqueue('math.floor', 2.5, group='math', cached=True)
|
||||
|
||||
# wait until this tasks group has 10 results
|
||||
result = a.result_group(count=10)
|
||||
@@ -122,4 +122,4 @@ Reference
|
||||
:param bool tasks: also deletes the associated tasks if ``True``
|
||||
:param bool cached: run this against the cache backend.
|
||||
:returns: the numbers of tasks affected
|
||||
:rtype: int
|
||||
:rtype: int
|
||||
|
||||
Reference in New Issue
Block a user