Async and Flower
anf allows you to elegantly organize and execute your tasks.
Installation
$ pip install anf
Example
import asyncio
from anf import run_flower
from anf import FlowerTask
async def fn_param(param: str) -> bool:
print(param)
await asyncio.sleep(2)
return True
async def main():
function_params = [
FlowerTask("p1").set_task_id("task_id-1"),
FlowerTask("p2"),
]
# run with FlowerTask list
await run_flower(function_params, fn_param, max_tasks=2)
# run with simple list
await run_flower(["p1", "p2"], fn_param, max_tasks=1)
# run with iter list
function_params = [
FlowerTask(["p1", "p2", "p3"]).set_iter(["param"]),
]
await run_flower(function_params, fn_param, max_tasks=1)
if __name__ == '__main__':
asyncio.run(main())
Metadata
Release files for anf 1.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 | |
|---|---|---|---|
| anf-1.1.0.tar.gz | 9.3 kB | Details |
Release files / anf-1.1.0.tar.gz
| Download URL | anf-1.1.0.tar.gz |
|---|---|
| Size | 9.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
31ec96722609440bae625223097697461ba844ed960d4efc5f9424ba417be70e
|
|
BLAKE2b-256 checksum How to use checksums |
27b5bd16de5153fbe76b369f1d2e63503486f491a43f34cb6961f9ee4de81372
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.3
|