Bounded ThreadPoolExecutor and ProcessPoolExecutor
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)
Metadata
Release files for bounded-executor 0.0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| bounded_executor-0.0.5-py3-none-any.whl | Python 3 | none | any | Details |
Release files / bounded_executor-0.0.5-py3-none-any.whl
| Download URL | bounded_executor-0.0.5-py3-none-any.whl |
|---|---|
| Size | 2.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4a5a0875122beb3f89e6e3db643441212e43177928b92feabf81e8a9f0361e9e
|
|
BLAKE2b-256 checksum How to use checksums |
24744299b0515a62e9efb9e278d54911f3100bca7c4aa244aa3189bdf4b76a92
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|