Skip to content

Latest commit

 

History

History
33 lines (21 loc) · 497 Bytes

README.md

File metadata and controls

33 lines (21 loc) · 497 Bytes

async-task

Distributed and scheduled tasks with Redis Pub/Sub

  • Create a container and define the tasks:
import asyncio
from async_task import TaskManager

manager = TaskManager()


@manager.register
async def task(name: str):
    print(f'Hello {name}')


if __name__ == '__main__':
    asyncio.run(manager.run())
  • Publish a message in the channel:
PUBLISH default '{"task":"task", "args": ["Chess"]}'
  • The task will produce the output:
Hello Chess