High: It blocks me to complete my task.
I need to create different objects of one class based on user input/init for ray serving and I am not able to find a way to do this in RAY. Dirty solution is to create lots of dummy classes(covering all possible objects that user will need), that inherits the common class that I am using.
If I could have created objects using input arguments and then serve objects, it would have been a neat solution. Unfortunately this I am not able to do in RAY…
Try the .options(name=...)
call:
import ray
from ray import serve
serve.start()
@serve.deployment
class C
def __call__(self, *args):
return "Hello world"
C.options(name="C1").deploy()
C.options(name="C2").deploy()
# Ping C1 with handle:
ray.get(serve.get_deployment("C1").get_handle().remote())
# Ping C2 with handle:
ray.get(serve.get_deployment("C2").get_handle().remote())
.options()
also lets you define each instance’s init_args
and init_kwargs
.
You can read more about deploying Ray Serve here.