You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+13-13
Original file line number
Diff line number
Diff line change
@@ -8,39 +8,39 @@ AioPool makes sure _no more_ and _no less_ (if possible) than `size` spawned cor
8
8
9
9
Read [code doctrings](../master/asyncio_pool/base_pool.py) for details.
10
10
11
-
> `AioPool(size=4, *, loop=None)`
11
+
#### AioPool(size=4, *, loop=None)
12
12
13
13
Creates pool of `size` concurrent tasks. Supports async context manager interface.
14
14
15
-
> `spawn(coro, cb=None, ctx=None)`
15
+
#### spawn(coro, cb=None, ctx=None)
16
16
17
17
Waits for pool space, then creates task for `coro` coroutine, returning future for it's result. Can spawn coroutine, created by `cb` with result of `coro` as first argument. `ctx` context is passed to callback as third positinal argument.
18
18
19
-
> `exec(coro, cb=None, ctx=None)`
19
+
#### exec(coro, cb=None, ctx=None)
20
20
21
21
Waits for pool space, then creates task for `coro`, then waits for it to finish, then returns result of `coro` if no callback is provided, otherwise creates task for callback, waits for it and returns result of callback.
22
22
23
-
> `spawn_n(coro, cb=None, ctx=None)`
23
+
#### spawn_n(coro, cb=None, ctx=None)
24
24
25
25
Creates waiting task for `coro`, returns future without waiting for pool space. Task is executed "in pool" when pool space is available.
26
26
27
-
> `join()`
27
+
#### join()
28
28
29
29
Waits for all spawned (active and waiting) tasks to finish. Joining pool from coroutine, spawned by the same pool leads to *deadlock*.
30
30
31
-
> `cancel(*futures)`
31
+
#### cancel(*futures)
32
32
33
33
Cancels spawned tasks (active and waiting), finding them by provided `futures`. If no futures provided -- cancels all spawned tasks.
Spawns coroutines created by `fn` function for each item in `iterable` with `spawn`, waits for all of them to finish (including callbacks), returns results maintaining order of `iterable`.
Spawns coroutines created by `fn` function for each item in `iterable` with `spawn_n`, returns futures for task results maintaining order of `iterable`.
Spawns tasks with `map_n(fn, iterable, cb, ctx)`, then waits for results with `asyncio.wait` function, yielding ready results one by one if `flat` == True, otherwise yielding list of ready results.
Copy file name to clipboardExpand all lines: docs/_readme_template.md
+9-9
Original file line number
Diff line number
Diff line change
@@ -8,39 +8,39 @@ AioPool makes sure _no more_ and _no less_ (if possible) than `size` spawned cor
8
8
9
9
Read [code doctrings](../master/asyncio_pool/base_pool.py) for details.
10
10
11
-
> `AioPool(size=4, *, loop=None)`
11
+
#### AioPool(size=4, *, loop=None)
12
12
13
13
Creates pool of `size` concurrent tasks. Supports async context manager interface.
14
14
15
-
> `spawn(coro, cb=None, ctx=None)`
15
+
#### spawn(coro, cb=None, ctx=None)
16
16
17
17
Waits for pool space, then creates task for `coro` coroutine, returning future for it's result. Can spawn coroutine, created by `cb` with result of `coro` as first argument. `ctx` context is passed to callback as third positinal argument.
18
18
19
-
> `exec(coro, cb=None, ctx=None)`
19
+
#### exec(coro, cb=None, ctx=None)
20
20
21
21
Waits for pool space, then creates task for `coro`, then waits for it to finish, then returns result of `coro` if no callback is provided, otherwise creates task for callback, waits for it and returns result of callback.
22
22
23
-
> `spawn_n(coro, cb=None, ctx=None)`
23
+
#### spawn_n(coro, cb=None, ctx=None)
24
24
25
25
Creates waiting task for `coro`, returns future without waiting for pool space. Task is executed "in pool" when pool space is available.
26
26
27
-
> `join()`
27
+
#### join()
28
28
29
29
Waits for all spawned (active and waiting) tasks to finish. Joining pool from coroutine, spawned by the same pool leads to *deadlock*.
30
30
31
-
> `cancel(*futures)`
31
+
#### cancel(*futures)
32
32
33
33
Cancels spawned tasks (active and waiting), finding them by provided `futures`. If no futures provided -- cancels all spawned tasks.
Spawns coroutines created by `fn` function for each item in `iterable` with `spawn`, waits for all of them to finish (including callbacks), returns results maintaining order of `iterable`.
Spawns coroutines created by `fn` function for each item in `iterable` with `spawn_n`, returns futures for task results maintaining order of `iterable`.
Spawns tasks with `map_n(fn, iterable, cb, ctx)`, then waits for results with `asyncio.wait` function, yielding ready results one by one if `flat` == True, otherwise yielding list of ready results.
0 commit comments