Use ProcessPoolExecutor and ThreadPoolExecutor from concurrent.futures with a progress bar and less boilerplate.
Project description
quickpool
Use ProcessPoolExecutor and ThreadPoolExecutor from concurrent.futures with a progress bar and less boilerplate.
Installation
Install with:
pip install quickpool
Usage
>>> import random
>>> import time
>>> import quickpool
>>> def naptime(base_duration: float, multiplier: float, return_val: int)->int:
... time.sleep(base_duration * multiplier)
... return return_val
...
>>> def demo():
... iterations = 25
... pool = quickpool.ThreadPool(
... functions = [naptime] * iterations,
... args_list = [(random.random() * 5, random.random()) for _ in range(iterations)],
... kwargs_list = [{"return_val": i} for i in range(iterations)])
... results = pool.execute()
... print(results)
...
>>> demo()
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 100% 3s
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
quickpool-2.0.0.tar.gz
(4.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file quickpool-2.0.0.tar.gz.
File metadata
- Download URL: quickpool-2.0.0.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fffef92e14736a524a154643d5bef004297c2feae47a5a138c8a4ce7b0fcd5a4
|
|
| MD5 |
94daaae05e56f5d0079d7b229ee6dbae
|
|
| BLAKE2b-256 |
e3c42c67f368c4e5e2887f245a2482174f49d599930292f7da646fc986535ed5
|
File details
Details for the file quickpool-2.0.0-py3-none-any.whl.
File metadata
- Download URL: quickpool-2.0.0-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08d46a06d7884828b35ca63c7dacb63bbfaad5ca95a7f93a736bbf83b3874cc4
|
|
| MD5 |
e5e5e8597e46cca5bd1424ac2062aff9
|
|
| BLAKE2b-256 |
8144e098bf9dbb4370f8b798ea0a575a4abcd80040ffec4b01ff79c0361633c3
|