From 7d2ba79a59905a350e343fb65a045e12b850680a Mon Sep 17 00:00:00 2001 From: Aleksandr Kiselev Date: Mon, 22 Aug 2022 21:48:04 +0300 Subject: [PATCH 1/2] Added some docs in readme.md --- README.md | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 72bf5b2..6d969ad 100644 --- a/README.md +++ b/README.md @@ -1 +1,63 @@ -## TaskIQ-Redis +# TaskIQ-Redis + +Taskiq-redis is a plugin for taskiq that adds a new broker and result backend based on redis. + +# Installation + +To use this project you must have installed core taskiq library: +```bash +pip install taskiq +``` +This project can be installed using pip: +```bash +pip install taskiq-redis +``` + +# Usage + +Let's see the example with the redis broker and redis async result: +```python +import asyncio + +from taskiq_redis.redis_broker import RedisBroker +from taskiq_redis.redis_backend import RedisAsyncResultBackend + + +redis_async_result = RedisAsyncResultBackend( + url="redis://localhost:6379", +) + +broker = RedisBroker( + url="redis://localhost:6379", + result_backend=redis_async_result, +) + + +@broker.task +async def best_task_ever() -> None: + """Solve all problems in the world.""" + await asyncio.sleep(5.5) + print("All problems are solved!") + + +async def main(): + task = await my_async_task.kiq() + print(await task.get_result()) + + +asyncio.run(main()) +``` + +## RedisBroker configuration + +RedisBroker parameters: +* `url` - url to redis. +* `task_id_generator` - custom task_id genertaor. +* `result_backend` - custom result backend. +* `queue_name` - name of the pub/sub channel in redis. +* `max_connection_pool_size` - maximum number of connections in pool. + +## RedisAsyncResultBackend configuration + +RedisAsyncResultBackend parameters: +* `url` - url to redis. From 438b6c0062bc95a3bde04fd551d1889873f6f97a Mon Sep 17 00:00:00 2001 From: Aleksandr Kiselev Date: Mon, 22 Aug 2022 21:52:18 +0300 Subject: [PATCH 2/2] Change pyproject.toml --- pyproject.toml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 4d83e80..d4481d2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,19 @@ name = "taskiq-redis" version = "0.0.2" description = "Redis integration for taskiq" authors = ["taskiq-team "] - +readme = "README.md" +classifiers = [ + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", +] +homepage = "https://github.com/taskiq-python/taskiq-redis" +repository = "https://github.com/taskiq-python/taskiq-redis" +keywords = ["taskiq", "tasks", "distributed", "async", "redis", "result_backend"] [tool.poetry.dependencies] python = "^3.7"