Skip to main content

Bounded ThreadPoolExecutor and ProcessPoolExecutor

Project description

If we use concurrent.futures’ ThreadPoolExecutor, ProcessPoolExecutor, easy to run into OOM issue since their waiting task queue size is not bounded. There is no limit how many tasked submitted.

BoundedThreadPoolExecutor

from bounded_executor import BoundedThreadPoolExecutor

def job(i):
    print(i)


with BoundedThreadPoolExecutor(max_workers=10, max_waiting_tasks=50) as pool:
    for i in range(1000):
        pool.submit(job, i)

BoundedProcessPoolExecutor

from bounded_executor import BoundedProcessPoolExecutor

def job(i):
    print(i)


with BoundedProcessPoolExecutor(max_workers=10, max_waiting_tasks=50) as pool:
    for i in range(1000):
        pool.submit(job, i)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

bounded_executor-0.0.5-py3-none-any.whl (2.3 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