Expool
Simple asynchronous execution pool primitive.
You can think of it as of a threading.ThreadPool for coroutines.
Usage
import asyncio
from expool import ExecutionPoolSimple
async def main():
pool = ExecutionPoolSimple(size=3) # size parameter sets the max amount of concurrent coroutines
async def some_job():
await asyncio.sleep(3)
await pool.add(some_job) # Returns immediately if the pool is not full.
await pool.add(some_job) # If the pool max size is reached, waits
# until one of the pool's coroutines finishes.
await pool.close() # wait for all of the jobs to finish.
You may also set a timeout for .close() method:
await pool.close(timeout=10)
If the timeout is reached, ExecutionPoolSimple cancels all remaining coroutines and returns.
You may also want to check out ExecutionPool decorators:
ExecutionPoolMonitored- a pool with periodical logging of the jobs inside the pool;ExecutionPoolCapped- a pool with a limited lifespan.
Installation
pip install expool
Metadata
Release files for expool 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| expool-0.1.1.tar.gz | 4.3 kB | Without provenance | Details for expool-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| expool-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for expool-0.1.1-py3-none-any.whl |
Total release size: 10.5 kB
Release files / expool-0.1.1.tar.gz
| Download URL | expool-0.1.1.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
34c218f46a345a18003eed14b3b20f1ab9ff4899213bdf16f944ea8e0bd1ba43
|
|
BLAKE2b-256 checksum How to use checksums |
678197775d15ed08e98cc11b2ba2bb86746b23a0c77a790a73b5610de2fc7592
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.7 CPython/3.8.10 Linux/5.11.0-25-generic
|
Release files / expool-0.1.1-py3-none-any.whl
| Download URL | expool-0.1.1-py3-none-any.whl |
|---|---|
| Size | 6.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
27f545cd733316b2038d51025aede99180e8ae77f31a91cef8c5292ec9d1019d
|
|
BLAKE2b-256 checksum How to use checksums |
8b5e16e437da9cfaaae2dc859374dabc84c652af11cff9c7f1311a42f23ddfec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.7 CPython/3.8.10 Linux/5.11.0-25-generic
|
Security for expool 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.