I have an expensive initialization that I want each worker to perform before it starts processing tasks. The resulting object should then be accessible to all tasks on that worker.
With Actors, it is quite straightforward, I initialize it in the constructor.
However, I am not clear on how to do it with tasks, and how to do it with the
Specifically, the initializer in the Pool API is not returning any value. The pattern I know from the python Pool is to assign to a global variable, which is then accessible also from the worker task. However, this does not seem to work with the ray Pool. What is the intended usage pattern for initializers in the ray multiprocessing Pool?