Distibutes tasks among processes and threads.
Project description
What PT_Pool?
It's a combined process+threading pool. (having only "apply_async" method for now)
ThreadPoolExecutor on its own doesn't utilize more than one CPU core.
ProcessPoolExecutor on its own is not suitable to provide concurrency (e.g. slows down the system when large number of processes are created, and doesn't allow to create more than around 1000 processes on my system).
Installation
python3.7 -m pip install PT_Pool
Usage
from PT_Pool import PT_Pool
import time
def f(x):
time.sleep(1)
return x*x
def on_result(res):
print(res)
pt_pool = PT_Pool(threads_limit = 100)
pt_pool.apply_async(f, range(10), on_result=on_result)
time.sleep(2)
input('Press enter to exit...')
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
PT_Pool-0.0.4.tar.gz
(3.6 kB
view details)
Built Distribution
File details
Details for the file PT_Pool-0.0.4.tar.gz
.
File metadata
- Download URL: PT_Pool-0.0.4.tar.gz
- Upload date:
- Size: 3.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.0 importlib_metadata/3.10.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a2f03f76f928989a6c9ac00ebeaef6e6e7dc1c134a3f8d1b66174d22b539a97 |
|
MD5 | 466c0e3816fb80262895296171ff2032 |
|
BLAKE2b-256 | a366bae2364f0a83a8dbd82231aef315ab51e2b13cf94eb583fb038254daa201 |
File details
Details for the file PT_Pool-0.0.4-py3-none-any.whl
.
File metadata
- Download URL: PT_Pool-0.0.4-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.0 importlib_metadata/3.10.1 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3667b20069f007e86f088dd60834cedbf584b03b6e381114578082527cce0d43 |
|
MD5 | fb2383d50a720696d33f91608a55de51 |
|
BLAKE2b-256 | 95d69feabf9d9aa34ba064acde212ad8647ee9fb232f73c238189f8858cb3b75 |