bounded_pool
Simplistic and universal bounded pool executor that allows to process N tasks
as the same time while limiting size of the queue. Tasks can be functions or
coroutines. Under the hood bounded_pool uses threads or processes, depending
on used class. Refer to tests/test_basic.py for details.
Tasks will only be submited when there are available workers (specified by
max_workers). You can specify max_queue_size to allow submiting more
tasks than amount of available workers (so workers won't have to wait for
task creation). Refer to tests/test_queue.py for details.
Exceptions inside of the tasks craeted with executors are ignored. Refer
to tests/test_exceptions.py for details.
Example / Showcase
import time
from bounded_pool import BoundedThreadPoolExecutor
def test_example():
futures = []
with BoundedThreadPoolExecutor() as pool:
for _ in range(64):
future = pool.submit(time.sleep, 1)
futures.append(future)
assert futures
for future in futures:
assert future.done()
assert future.result() is None
License
Metadata
Release files for bounded-pool 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| bounded_pool-0.0.2.tar.gz | 4.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bounded_pool-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.0 kB
Release files / bounded_pool-0.0.2.tar.gz
| Download URL | bounded_pool-0.0.2.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dff6fd8c9cda225910c3ab123487a8dbb482177a2a473bc12d77835df272e991
|
|
BLAKE2b-256 checksum How to use checksums |
399f8b135666d320875baa45874fdbabaf352329c65d6d484c0342bca9119e1c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|
Release files / bounded_pool-0.0.2-py3-none-any.whl
| Download URL | bounded_pool-0.0.2-py3-none-any.whl |
|---|---|
| Size | 3.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
848aee93afe70c69e320d5d320be30d1dbb26cf85a61f50556ee2e5f655bbb69
|
|
BLAKE2b-256 checksum How to use checksums |
79234f82179cad6268d796b5a8e9939abc8182e64db8fc26f9a4976e5e673031
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|