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.0.tar.gz
(4.4 kB
view hashes)
Built Distribution
Close
Hashes for quickpool-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff5630d4f57630385b4cd25ba59b17ff6355681abaff4750c8f28a3b699c3b37 |
|
MD5 | a0b35693bb0dd4569c9c256cb6a5d6bc |
|
BLAKE2b-256 | e6ddeb35e340a5ad3d74284c36235336a982f30e5ebdc0883a9f6c43976d7a59 |