Skip to content

Concurrent tasks with dependencies #233

Answered by s3rius
kevinhikaruevans asked this question in Q&A
Discussion options

You must be logged in to vote

TaskiqDepends has support for kwargs, but it cannot be used for dynamic dependency generation and you cannot use task arguments as dependency argument. Maybe this can be a good feature. I created an issue, but it's hard implement, so I cannot provide you with due date.

For now, you can either create multiple tasks, or call your function at the beginning.

Here's simple example of using kwargs in TaskiqDepends. As you can see, it's only simple static values.

import asyncio
from taskiq import InMemoryBroker, TaskiqDepends

broker = InMemoryBroker()

async def dependency(sleep_time: float) -> float:
    await asyncio.sleep(sleep_time)
    return sleep_time

@broker.task
async def short_sleep(s…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by kevinhikaruevans
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants