Get handle to depoyment based on name

Just upgrading to ray 1.4 and trying to migrate to using deployments. Is there a way to lookup a deployment based on its name? (Ultimately trying to create multiple deployments using the same class just with different injected behaviors)

model_id = "some dynamic id"
 ImageModel.options(init_args=model_args, num_replicas=NUM_REPS, name=model_id ).deploy()

and then later something along the lines of ImageModel.get_handle(model_id)? (not the real 1.4 API, example only for what I want to do conceptually).

Right now, it appears I can only do ImageModel.get_handle(). Additionally, if I do specify a name in the options, and then try ImageModel.get_handle(), that doesn’t not work either.

Seek and you shall find. Core API: Deployments — Ray v1.4.0

 handle = serve.get_deployment(model_id).get_handle()
1 Like