Skip to main content

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 hashes)

Uploaded Source

Built Distribution

quickpool-1.0.2-py3-none-any.whl (5.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page