Skip to main content

Library for running tasks in bounded pool executors.

Project description

bounded_pool

PyPI version

Simplistic and universal bounded pool executor that allows to process N tasks as the same time while limiting size of the queue. Tasks can be functions or coroutines. Under the hood bounded_pool uses threads or processes, depending on used class. Refer to tests/test_basic.py for details.

Tasks will only be submited when there are available workers (specified by max_workers). You can specify max_queue_size to allow submiting more tasks than amount of available workers (so workers won't have to wait for task creation). Refer to tests/test_queue.py for details.

Example / Showcase

import time
from bounded_pool import BoundedThreadPoolExecutor


def test_example():
    futures = []

    with BoundedThreadPoolExecutor() as pool:
        for _ in range(64):
            future = pool.submit(time.sleep, 1)
            futures.append(future)

    assert futures

    for future in futures:
        assert future.done()
        assert future.result() is None

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

bounded_pool-0.0.1.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

bounded_pool-0.0.1-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file bounded_pool-0.0.1.tar.gz.

File metadata

  • Download URL: bounded_pool-0.0.1.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for bounded_pool-0.0.1.tar.gz
Algorithm Hash digest
SHA256 d84ef6e0e6c81625e173222071a64a4e21ebf05b833ca1e87fcd8750a7a19174
MD5 ac685f74f42ad0a14ce91100505b8831
BLAKE2b-256 1bacd139281a2e9652fbe75a57b614dc69cce3e0d3e911b435928c39b292c74c

See more details on using hashes here.

File details

Details for the file bounded_pool-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for bounded_pool-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e53fd67561b4ea69d5b619fc729c0798b1409638e8d4b209f5ac3b145745baa9
MD5 1c3cd867b8c1913f2fa158587cf60f06
BLAKE2b-256 4ba85ef8c63ef214520ff13bd0c9b57d842e30369a6685a5e6b5a97d2bd1429e

See more details on using hashes here.

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