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() runtime:2s [___________________________________________________________________]-100.00% [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-0.1.0.tar.gz
(38.9 kB
view hashes)
Built Distribution
Close
Hashes for quickpool-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 891def65619c189a05b0809cb9c6867d907faef596ded948efb8c1ae1c358e6c |
|
MD5 | 91adf4c920faebf3a20a0f366d01a770 |
|
BLAKE2b-256 | 54f04bd3a7e944113dada922b939d34ea9e4357f38922ce3ae023b708665ec28 |