Returning multiple ObjRef from Ray Serve deployment

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

  • Medium: It contributes to significant difficulty to complete my task, but I can work around it.

I want to write a Ray Serve deployment that returns multiple outputs (2 or 3). I found that Ray Actor has a parameter “num_returns” but couldn’t find a way to specify this for a deployment. Now when I want to write:
image, mask = await self.objectmask_handle.remote(image) it fails with an error, because deployment returns a single ObjRef for a tuple. I can do it in a multiple lines:

image_mask = await self.objectmask_handle.remote(image)
image, mask = await image_mask

But this is strange pattern, isn’t it? Is there a better way to handle such cases?