Layout tasks with async and flower
Project description
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 and set iter
await run_flower(["p1", "p2"], fn_param, max_tasks=1).set_iter(["param"])
if __name__ == '__main__':
asyncio.run(main())
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
anf-1.0.0.tar.gz
(9.3 kB
view details)
File details
Details for the file anf-1.0.0.tar.gz.
File metadata
- Download URL: anf-1.0.0.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f515691a23694e915c165030026155242da44a1659245bbdefc011ce62e75dd7
|
|
| MD5 |
ad04e93942304c8cdd76c79893c9c4e8
|
|
| BLAKE2b-256 |
6fad56b236b0d06311b92fd9abbe9afb4f5bed9ea67d0fe0f4c2fecaeec7e840
|