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:
Pierre-Elliott Bécue
2018-07-07 21:33:43 +02:00
parent 2040771e80
commit ae75a84f7f
16 changed files with 190 additions and 190 deletions
+5 -5
View File
@@ -110,19 +110,19 @@ Check overall statistics with::
Creating Tasks
~~~~~~~~~~~~~~
Use `async` from your code to quickly offload tasks:
Use `enqueue` from your code to quickly offload tasks:
.. code:: python
from django_q.tasks import async, result
from django_q.tasks import enqueue, result
# create the task
async('math.copysign', 2, -2)
enqueue('math.copysign', 2, -2)
# or with a reference
import math.copysign
task_id = async(copysign, 2, -2)
task_id = enqueue(copysign, 2, -2)
# get the result
task_result = result(task_id)
@@ -133,7 +133,7 @@ Use `async` from your code to quickly offload tasks:
# but in most cases you will want to use a hook:
async('math.modf', 2.5, hook='hooks.print_result')
enqueue('math.modf', 2.5, hook='hooks.print_result')
# hooks.py
def print_result(task):