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.2.0.tar.gz
(5.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.2.0.tar.gz.
File metadata
- Download URL: quickpool-2.2.0.tar.gz
- Upload date:
- Size: 5.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 |
c9960b84c5d9b2308dd0e9ec4f556669d0e7ea0a4f5a4fc92ef612f4e2ed5802
|
|
| MD5 |
0282f70b64016ff02e02c841007afc7c
|
|
| BLAKE2b-256 |
0cccc75e3070578f6c895c9183333ed05cdfefb6f98e6e523f56e5288f58fb19
|
File details
Details for the file quickpool-2.2.0-py3-none-any.whl.
File metadata
- Download URL: quickpool-2.2.0-py3-none-any.whl
- Upload date:
- Size: 6.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 |
d08c0580dc0bb149b8b31162aa519a2c3d71b08bd613bb77574cce86055fa95d
|
|
| MD5 |
97dc532fe12d9c1a5ad7112706e6924f
|
|
| BLAKE2b-256 |
09eb67bad1b6c49e4b67dbe14d89ef19a871c71fde75270792c077a8e7c61b35
|