YDB integration for taskiq
Project description
taskiq + ydb
Plugin for taskiq that adds a new result backend and broker based on YDB.
Installation
This project can be installed using pip/poetry/uv (choose your preferred package manager):
pip install taskiq-ydb
Usage
Let's see the example with the redis broker and YDB result backend:
# example.py
import asyncio
from ydb.aio.driver import DriverConfig
from taskiq_ydb import YdbBroker, YdbResultBackend
driver_config = DriverConfig(
endpoint='grpc://localhost:2136',
database='/local',
)
broker = YdbBroker(
driver_config=driver_config,
).with_result_backend(YdbResultBackend(driver_config=driver_config))
@broker.task(task_name='best_task_ever')
async def best_task_ever() -> str:
"""Solve all problems in the world."""
return 'Problems solved!'
async def main() -> None:
"""Start the application with broker."""
await broker.startup()
task = await best_task_ever.kiq()
result = await task.wait_result()
print(f'Task result: {result.return_value}')
await broker.shutdown()
if __name__ == '__main__':
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
Example can be run using the following command:
# Start broker
python3 -m example
# Start worker for executing command
taskiq worker example:broker
Configuration
Broker:
driver_config: connection config for YDB client, you can read more about it in YDB documentation;topic_path: path to the topic where tasks will be stored, default is/taskiq-tasks;connection_timeout: timeout for connection to database during startup, default is 5 seconds.read_timeout: timeout for read topic operation, default is 5 seconds.
Result backend:
driver_config: connection config for YDB client, you can read more about it in YDB documentation;table_name: name of the table in PostgreSQL to store TaskIQ results;serializer: type ofTaskiqSerializerdefault isPickleSerializer;pool_size: size of the connection pool for YDB client, default is5;connection_timeout: timeout for connection to database during startup, default is 5 seconds.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file taskiq_ydb-0.2.0.tar.gz.
File metadata
- Download URL: taskiq_ydb-0.2.0.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.6.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13f3f912b6dad1dee733fc66e18ac44525d91a661fd23beaba6ae5ed48aca339
|
|
| MD5 |
bd2592177be6259b6a099091924ebbf3
|
|
| BLAKE2b-256 |
2b8301dbaabbe475b07c7118dbc27fa6396c0896786d04f01c2c381117521007
|
File details
Details for the file taskiq_ydb-0.2.0-py3-none-any.whl.
File metadata
- Download URL: taskiq_ydb-0.2.0-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.6.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d9e48b35b0e15532c409569cb9b30a98e5d9b3bffeddb68c6670b24408fd2280
|
|
| MD5 |
446ad16711933d18269a78177d1fbbc7
|
|
| BLAKE2b-256 |
ea18a88c12ac87cf5a34e4eedbfe043d1338f9abb9aadbb288486c23c482fc28
|