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

Uploaded Python 3

File details

Details for the file bounded_executor-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: bounded_executor-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 2.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for bounded_executor-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 4a5a0875122beb3f89e6e3db643441212e43177928b92feabf81e8a9f0361e9e
MD5 e326a092c099f37c66030df04c8a0056
BLAKE2b-256 24744299b0515a62e9efb9e278d54911f3100bca7c4aa244aa3189bdf4b76a92

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