How remote and get work?

I‘m interested in how the Ray function ‘remote’ and ‘get’ work. There is a demo program.

def a():
    a=some array
    return a

future=[a.remote() for _ in range(3)]

The function ‘a’ will be running when I call remote or running when I call get?

It will be submitted to run after you call remote. But when it will run depends on the current available resources of the system (sometimes it needs to wait for occupied resources to be freed first). But when ray.get returns, it must finish running.

1 Like

If available resources are enough, ray.get will block the program until remote finishes running?

ray.get will, by default, block the program until remote finishes running. But you can provide timeout argument.

1 Like