App instance as a worker

How severe does this issue affect your experience of using Ray?

  • Low: It annoys or frustrates me for a moment.

Hi, I have working python app. I’m trying to make it multi instance app with capability to spread GPU computation.
I tried to work with Ray but I noticed the way how Ray works is not the best for me. Ray serialize function with big chunk of app and tries to run in worker.
I think, for my case, would be better to run whole app as worker and use smth like remote code exeucution. Without serialize whole methods because method is already present in another app instance.

Is ray suitable for such case?

Hey @CloneOfMyHead - great question. Yes, you are absolutely right with the function serialization part since ray defaults to start remote workers ad-hoc, thus assuming the remote workers have no access to the function definition.

When you said “method is already present in another app instance”, would you elaborate a bit more here? e.g. did you prep the working directory on the remote worker already by replicating all the needed source files?

did you prep the working directory on the remote worker already by replicating all the needed source files?

No but I also wondered if it’s possible to pre load code someway similar to how it’s done by ray. I gave up because it’s sounds hacky and it’s my first time with ray.

What I did it was just calling ray.init() in the app instance and connect to existing cluster. My expectations was (I know now it’s not how it works) that ray will figure out “Hey! I’m another instance of the same app. Resuse my code”.

We are working on a proposal to run some user defined code at worker start-up. I believe that should probably unblock you for your usecase?

But - yes, right now, I think Ray isn’t able to figure out that automatically as you described.

cc @sangcho

cc @raulchen I believe there was a way to load code from local instead of serializing and sending it? Do you happen to know how to enable this?

There is a load_code_from_local flag. I checked the code, currently it’s only turned on when the app is started via job submission api.