8000 Fix the async howto · Develop-Python/procrastinate@1307c3f · GitHub
[go: up one dir, main page]

Skip to content

Commit 1307c3f

Browse files
author
Éric Lemoine
committed
Fix the async howto
The async howto currently states that jobs are always executed sequentially in a worker. procrastinate-org#106 changed that, so we need to update that part of the docs.
1 parent e2f0061 commit 1307c3f

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

docs/howto/async.rst

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,15 @@ If your job is a coroutine, it will be awaited::
2929
async def my_task(a, b):
3030
await asyncio.sleep(3)
3131

32-
# Tasks being async or not can be awaited asynchronously or not
32+
With async tasks (such as ``my_task`` above), and with ``concurrency`` set to a value
33+
greater than ``1`` in the Procrastinate worker, the worker process may execute multiple
34+
jobs at the same time. See `./concurrency` for more information on how to configure
35+
Procrastinate workers for concurrent jobs.
36+
37+
Note that tasks can be deferred asynchronously or synchronously, whether they are async
38+
or not::
39+
40+
# Note: tasks being async or not can be awaited asynchronously or not
3341
await my_task.defer_async(a=1, b=2)
3442
# or
3543
my_task.defer(a=1, b=2)
36-
37-
As of today, jobs are still executed
38-
sequentially, so if you have 100 asynchronous jobs that each take 1 second doing
39-
asynchronous I/O, you would expect the complete queue to run in little over 1 second,
40-
and instead it will take 100 seconds.
41-
42-
In the future, you will be able to process asynchronous jobs in parallel (see ticket__).
43-
44-
__ https://github.com/peopledoc/procrastinate/issues/106

0 commit comments

Comments
 (0)
0