Async Batch Engine
An asynchronous batch processing engine for Python.
Installation
pip install abatchtaskpool
Usage
from typing import Any, List
import asyncio
from abatchtaskpool.async_batch_engine import AsyncBatchEngine
async def example_processing_function(inputs: List[Any]) -> List[Any]:
"""示例批处理函数"""
await asyncio.sleep(1) # 模拟处理耗时
return [f"Processed_{item}" for item in inputs]
async def main():
# 创建引擎实例
engine = AsyncBatchEngine(
processing_function=example_processing_function,
batch_size=5,
wait_timeout=0.5,
num_workers=2
)
# 提交任务并获取结果
tasks = [
engine.add_request(f"task_{i}", f"req_{i}")
for i in range(10)
]
results = await asyncio.gather(*tasks)
# 输出结果
for result in results:
print(f"Result: {result}")
# 停止引擎
await engine.stop()
if __name__ == "__main__":
asyncio.run(main())
Metadata
Release files for abatchtaskpool 0.1.0
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 |
|---|---|---|---|---|
| abatchtaskpool-0.1.0.tar.gz | 3.8 kB | Without provenance | Details for abatchtaskpool-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| abatchtaskpool-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for abatchtaskpool-0.1.0-py3-none-any.whl |
Total release size: 8.6 kB
Release files / abatchtaskpool-0.1.0.tar.gz
| Download URL | abatchtaskpool-0.1.0.tar.gz |
|---|---|
| Size | 3.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
419e60db4436fdbaa3831e7b792f779be557b66adc854a95eea9e03a5eacec06
|
|
BLAKE2b-256 checksum How to use checksums |
1ddb95def550b684c445df5c890c21d1aecb852b9edfe1d6a68ba9198180c2d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Release files / abatchtaskpool-0.1.0-py3-none-any.whl
| Download URL | abatchtaskpool-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
705d563fc9f526d77bb5b19bc7da668a21cda9c41eb1273a36885586dbdefa4a
|
|
BLAKE2b-256 checksum How to use checksums |
ef888e84d254cdc88ba0ed7cc0282604b5e2c5ec8153f45e514bc13ea18bfdbc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.7
|
Security for abatchtaskpool 0.1.0
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.