code: def _get_service_deployment(
      svc: bentoml.Service, **kwargs
  ) -> Deployment:
      @serve.deployment(name=f"bento-svc-{svc.name}", **kwargs)
      class BentoDeployment:
          def __init__(
              self, **runner_deployments: dict[str, Deployment]
          ):
              from ..server.http_app import HTTPAppFactory
  
              # Use Ray's metrics setup. Ray has already initialized a prometheus client
              # for multi-process and this conflicts with BentoML's prometheus setup
              self.app = HTTPAppFactory(svc, enable_metrics=False)()
  
              for runner in svc.runners:
                  assert runner.name in runner_deployments
                  runner._set_handle(
                      RayRunnerHandle, runner_deployments[runner.name]
                  )
  
          async def __call__(self, request: requests.Request):
              sender = ASGIHTTPSender()
              await self.app(
                  request.scope, receive=request.receive, send=sender
              )
              return sender.build_asgi_response()
  
      return BentoDeployment
  
file_path: BentoML/grpc-client/bentoml/_internal/ray/__init__.py
imports: from __future__ import annotations
  import typing
  from functools import partial
  import requests
  from ..._internal.utils import pkg
  import bentoml
  from bentoml import Tag
  from ...exceptions import MissingDependencyException
  from ..runner.container import AutoContainer
  from ..runner.utils import Params
  from .runner_handle import RayRunnerHandle
label_desc: Use image node_id 2 for calling a global function with example usage: _get_service_deployment(svc) and returns: BentoDeployment, sender