ICIJ's async worker library 
Installation
With AMQP:
pip install icij-worker["amqp"]
With neo4j:
pip install icij-worker["neo4j"]
Usage
Create an async app and register tasks
Create asynchronous task tailored for long running Python functions:
Given the following pure Python function inside the app.py module:
def long_running_task(greeted: str) -> str:
greeting = f"Hello {greeted} !"
return greeting
decorate your function with ICIJApp class and register a new task:
from icij_worker import AsyncApp
my_app = AsyncApp(name="my_app")
@my_app.task
def long_running_task(greeted: str) -> str:
greeting = f"Hello {greeted} !"
return greeting
this will register the long_running_task function under the long_running_task task name.
Optionally add progress handlers for a better task monitoring:
@my_app.task
async def long_running_task(
greeted: str,
progress: Optional[Callable[[float], Awaitable]] = None
) -> str:
if progress is not None:
await progress(0.0)
greeting = f"Hello {greeted} !"
if progress is not None:
await progress(100.0)
return greeting
Launch a async worker pool
Start a worker pool using:
icij-worker workers start "app.my_app"
provide worker pool options using:
icij-worker workers start -c worker_config.json -n 2 --backend multiprocessing "app.my_app"
depending on the worker configuration additional setup might be required.
Async worker implementations
Worker asynchronous backends
Implemented
- multiprocessing for CPU bound tasks
To be implemented
- asyncio for I/O bound tasks
Metadata
Release files for icij-worker 0.20.2
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 |
|---|---|---|---|---|
| icij_worker-0.20.2.tar.gz | 59.8 kB | Without provenance | Details for icij_worker-0.20.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| icij_worker-0.20.2-py3-none-any.whl | Python 3 | none | any | Details for icij_worker-0.20.2-py3-none-any.whl |
Total release size: 145.1 kB
Release files / icij_worker-0.20.2.tar.gz
| Download URL | icij_worker-0.20.2.tar.gz |
|---|---|
| Size | 59.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cba6899fca55cc23cce56ebe2b970b74638f10572f420add09cc3b6043249212
|
|
BLAKE2b-256 checksum How to use checksums |
4ad2b267cb1de2f1d9023e820bd64383eae95fbc018d857e60c5d2229c074aa6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.6.7
|
Release files / icij_worker-0.20.2-py3-none-any.whl
| Download URL | icij_worker-0.20.2-py3-none-any.whl |
|---|---|
| Size | 85.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b1f6015c3bff7e4092dbb7ae208c4a77d6c6635f9aa4b46c4da784db7ccd879d
|
|
BLAKE2b-256 checksum How to use checksums |
927e7ccabd5a27443dd5d623c4989b978430d077c5a6ce304ac4a35e27f7c48f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.6.7
|
Security for icij-worker 0.20.2
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.