Best solution to have multiprocess working in actor?

Ray’s multi processing lib should be the drop-in replacement of mp library, but it doesn’t support full APIs. So there’s def possibility your application won’t be ported seamlessly. For your issue, it is highly likely you have implicit capture of un-pickleable object in your actor definition. This is an example of implicit capture.

a = object # Imagine this is a lock object

@ray.remote
class A:
    def __init(self)__:
        # In this case, a is captured from the above reference a, it should be pickelable.
        self.a = a 

To help troubleshooting this sort of serialization issue, we support a inspection tool; Serialization — Ray v2.0.0.dev0

One other thing you can try is to import multi processing library within an actor like this;

@ray.remote
class RayServer(object):
def serve(self):
    import [multi processing library]
    test_multi_process()
    return “SSSSSS return”