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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
quickpool-1.0.2.tar.gz
(4.4 kB
view details)
Built Distribution
File details
Details for the file quickpool-1.0.2.tar.gz
.
File metadata
- Download URL: quickpool-1.0.2.tar.gz
- Upload date:
- Size: 4.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cca4e252100785dbc434f55b515f4cb41390d583cfb69267191041ecd434670a |
|
MD5 | a2af19c9261b1a167ce0c134b4cf45e9 |
|
BLAKE2b-256 | cd73b797cc3775ebb5a810323858b992ed9c765dea0ce4cf0679406e2f14d560 |
File details
Details for the file quickpool-1.0.2-py3-none-any.whl
.
File metadata
- Download URL: quickpool-1.0.2-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8672d74cbf263df29629cbcb072bb2084b98064d36003151699a54db8271c2d5 |
|
MD5 | ce8e3fce3fc8cecd10acff67a47fff0c |
|
BLAKE2b-256 | f68c8c7a02a839c175791bbcfdfd67a6e10d5f7c5b399f8146ffb99e893f2f59 |