code: def run(
      target: Application,
      _blocking: bool = True,
      host: str = DEFAULT_HTTP_HOST,
      port: int = DEFAULT_HTTP_PORT,
      name: str = SERVE_DEFAULT_APP_NAME,
      route_prefix: str = DEFAULT.VALUE,
      logging_config: Optional[Union[Dict, LoggingConfig]] = None,
  ) -> DeploymentHandle:
      """Run an application and return a handle to its ingress deployment.
  
      The application is returned by `Deployment.bind()`. Example:
  
      .. code-block:: python
  
          handle = serve.run(MyDeployment.bind())
          ray.get(handle.remote())
  
      Args:
          target:
              A Serve application returned by `Deployment.bind()`.
          host: [DEPRECATED: use `serve.start` to set HTTP options]
              Host for HTTP servers to listen on. Defaults to
              "127.0.0.1". To expose Serve publicly, you probably want to set
              this to "0.0.0.0".
          port: [DEPRECATED: use `serve.start` to set HTTP options]
              Port for HTTP server. Defaults to 8000.
          name: Application name. If not provided, this will be the only
              application running on the cluster (it will delete all others).
          route_prefix: Route prefix for HTTP requests. If not provided, it will use
              route_prefix of the ingress deployment. If specified neither as an argument
              nor in the ingress deployment, the route prefix will default to '/'.
          logging_config: Application logging config. If provided, the config will
              be applied to all deployments which doesn't have logging config.
  
      Returns:
          DeploymentHandle: A handle that can be used to call the application.
      """
  
      if len(name) == 0:
          raise RayServeException(
              "Application name must a non-empty string."
          )
  
      if host != DEFAULT_HTTP_HOST or port != DEFAULT_HTTP_PORT:
          warnings.warn(
              "Specifying host and port in `serve.run` is deprecated and will be "
              "removed in a future version. To specify custom HTTP options, use "
              "`serve.start`."
          )
  
      client = _private_api.serve_start(
          http_options={
              "host": host,
              "port": port,
              "location": "EveryNode",
          },
      )
  
      # Record after Ray has been started.
      ServeUsageTag.API_VERSION.record("v2")
  
      if isinstance(target, Application):
          deployments = pipeline_build(
              target._get_internal_dag_node(), name
          )
          ingress = get_and_validate_ingress_deployment(deployments)
      else:
          msg = "`serve.run` expects an `Application` returned by `Deployment.bind()`."
          if isinstance(target, DAGNode):
              msg += (
                  " If you are using the DAG API, you must bind the DAG node to a "
                  "deployment like: `app = Deployment.bind(my_dag_output)`. "
              )
          raise TypeError(msg)
  
      parameter_group = []
  
      for deployment in deployments:
          # Overwrite route prefix
          if (
              route_prefix is not DEFAULT.VALUE
              and deployment._route_prefix is not None
          ):
              if (
                  route_prefix is not None
                  and not route_prefix.startswith("/")
              ):
                  raise ValueError(
                      "The route_prefix must start with a forward slash ('/')"
                  )
  
              deployment._route_prefix = route_prefix
          if deployment.logging_config is None and logging_config:
              if isinstance(logging_config, dict):
                  logging_config = LoggingConfig(**logging_config)
              deployment.set_logging_config(logging_config.dict())
          deployment_parameters = {
              "name": deployment._name,
              "replica_config": deployment._replica_config,
              "deployment_config": deployment._deployment_config,
              "version": deployment._version or get_random_string(),
              "route_prefix": deployment.route_prefix,
              "url": deployment.url,
              "docs_path": deployment._docs_path,
              "ingress": deployment._name == ingress._name,
          }
          parameter_group.append(deployment_parameters)
      client.deploy_application(
          name,
          parameter_group,
          _blocking=_blocking,
      )
  
      if ingress is not None:
          # The deployment state is not guaranteed to be created after
          # deploy_application returns; the application state manager will
          # need another reconcile iteration to create it.
          client._wait_for_deployment_created(ingress.name, name)
          handle = client.get_handle(
              ingress.name, name, missing_ok=True
          )
          return handle
  
imports: import collections
  import inspect
  import logging
  import warnings
  from functools import wraps
  from typing import Any, Callable, Dict, List, Optional, Union
  from fastapi import APIRouter, FastAPI
  import ray
  from ray import cloudpickle
  from ray._private.serialization import pickle_dumps
  from ray.dag import DAGNode
  from ray.serve._private.config import DeploymentConfig, ReplicaConfig
  from ray.serve._private.constants import DEFAULT_HTTP_HOST, DEFAULT_HTTP_PORT, SERVE_DEFAULT_APP_NAME
  from ray.serve._private.deployment_graph_build import build
  from ray.serve._private.deployment_graph_build import get_and_validate_ingress_deployment
  from ray.serve._private.http_util import ASGIAppReplicaWrapper, make_fastapi_class_based_view
  from ray.serve._private.usage import ServeUsageTag
  from ray.serve._private.utils import DEFAULT, Default, ensure_serialization_context, extract_self_if_method_call, get_random_string
  from ray.serve.config import AutoscalingConfig, DeploymentMode, HTTPOptions, ProxyLocation, gRPCOptions
  from ray.serve.context import ReplicaContext, _get_global_client, _get_internal_replica_context, _set_global_client
  from ray.serve.deployment import Application, Deployment
  from ray.serve.exceptions import RayServeException
  from ray.serve.handle import DeploymentHandle
  from ray.serve.multiplex import _ModelMultiplexWrapper
  from ray.serve.schema import LoggingConfig, ServeInstanceDetails, ServeStatus
  from ray.util.annotations import Deprecated, DeveloperAPI, PublicAPI
  from ray.serve._private import api
label_desc: Use image node_id 8 for calling a global function with example usage: run(target, _blocking, host, port, name, route_prefix, logging_config) and returns: handle