[Python] Python - asyncio task execution issue [closed]

Discussão em 'Python' iniciado por Stack, Fevereiro 5, 2025.

  1. Stack

    Stack Membro Participativo

    I am calling the set of functions using asyncio in which each of the function when run alone, runs under a sec but when calling via asyncio and gather, it goes upto 4 sec. I want to get it down to the stage where max time should be the time taken by the long running function.

    for example, function 1 = 1 sec, function 2 = 3 sec, function 3 = 1.5 sec, then the overall execution time should be 3 but in my case it comes more than 4 or 5.

    tasks = [call_function(func_name, **params) for func_name, params in functions_with_params] results = await asyncio.gather(*tasks)
    Functions call the AI models. How to fix the issue.

    Continue reading...

Compartilhe esta Página