- Medium: It contributes to significant difficulty to complete my task, but I can work around it.
Main Question
The page “Nested Remote Functions” says “Remote functions can call other remote functions…”
Can remote functions call normal functions? I am not sure if it will change the remote function being called simultaneously to a blocking call where it runs sequentially on different worker processes.
More context
The slightly modified code from the same Ray docs page should work:
@ray.remote
def f():
return 1
@ray.remote
def g():
# Call f 4 times and return the resulting object refs.
return [f.remote() for _ in range(4)]
ray.get([g.remote() for _ in range(5)])
Will the below code work (where I changed f
from a remote to a normal function) as expected (i.e., g is run simultaneously on different worker processes)?
def f():
return 1
@ray.remote
def g():
# Call f 4 times and return the resulting object refs.
return [f() for _ in range(4)]
ray.get([g.remote() for _ in range(5)])