Suppose that the scheduler allocates a worker process to a function/task. I know that the Core Worker needs to send this function to the worker for execution. In traditional RPC, the service (corresponding to the function here) is defined in advance on the server side (corresponding to the worker here). So, my question is how does Ray transfer the function body and let worker execute it ?
When @ray.remote is called, the function is pickled and then stored in Ray’s internal key-value store (used for cluster metadata). Workers will load the function definition from there.
You can find the source code here.
Thank you for your answer.