1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] How to make ray task async

Discussão em 'Python' iniciado por Stack, Setembro 11, 2024.

  1. Stack

    Stack Membro Participativo

    I want to run a function (Ray Task) that may trigger another request afterward.

    For example, if I have 10 tasks but only 1 CPU, the system will process one task at a time since each task requires 1 CPU.

    However, each of these tasks makes an external API call.

    @ray.remote
    def fetch():
    request.get(...)


    I would like to make this API request asynchronous and await its completion, so instead of processing one task at a time, I can run all tasks concurrently. If I call fetch 10 times, all 10 API requests should run in parallel, and once the requests are complete, each task should resume sequential processing.

    How can I achieve this with Ray?

    Continue reading...

Compartilhe esta Página