code: def build(
      ray_dag_root_node: DAGNode, name: str = SERVE_DEFAULT_APP_NAME
  ) -> List[Deployment]:
      """Do all the DAG transformation, extraction and generation needed to
      produce a runnable and deployable serve pipeline application from a valid
      DAG authored with Ray DAG API.
  
      This should be the only user facing API that user interacts with.
  
      Assumptions:
          Following enforcements are only applied at generating and applying
          pipeline artifact, but not blockers for local development and testing.
  
          - ALL args and kwargs used in DAG building should be JSON serializable.
              This means in order to ensure your pipeline application can run on
              a remote cluster potentially with different runtime environment,
              among all options listed:
  
                  1) binding in-memory objects
                  2) Rely on pickling
                  3) Enforce JSON serialibility on all args used
  
              We believe both 1) & 2) rely on unstable in-memory objects or
              cross version pickling / closure capture, where JSON serialization
              provides the right contract needed for proper deployment.
  
          - ALL classes and methods used should be visible on top of the file and
              importable via a fully qualified name. Thus no inline class or
              function definitions should be used.
  
      Args:
          ray_dag_root_node: DAGNode acting as root of a Ray authored DAG. It
              should be executable via `ray_dag_root_node.execute(user_input)`
              and should have `InputNode` in it.
          name: Application name,. If provided, formatting all the deployment name to
              {name}_{deployment_name}, if not provided, the deployment name won't be
              updated.
  
      Returns:
          deployments: All deployments needed for an e2e runnable serve pipeline,
              accessible via python .remote() call.
  
      Examples:
  
          .. code-block:: python
  
              with InputNode() as dag_input:
                  m1 = Model.bind(1)
                  m2 = Model.bind(2)
                  m1_output = m1.forward.bind(dag_input[0])
                  m2_output = m2.forward.bind(dag_input[1])
                  ray_dag = ensemble.bind(m1_output, m2_output)
  
          Assuming we have non-JSON serializable or inline defined class or
          function in local pipeline development.
  
          .. code-block:: python
  
              from ray.serve.api import build as build_app
              deployments = build_app(ray_dag) # it can be method node
              deployments = build_app(m1) # or just a regular node.
      """
      with _DAGNodeNameGenerator() as node_name_generator:
          serve_root_dag = ray_dag_root_node.apply_recursive(
              lambda node: transform_ray_dag_to_serve_dag(
                  node, node_name_generator, name
              )
          )
      deployments = extract_deployments_from_serve_dag(serve_root_dag)
  
      # If the ingress deployment is a function and it is bound to other deployments,
      # reject.
      if (
          isinstance(serve_root_dag, DeploymentFunctionNode)
          and len(deployments) != 1
      ):
          raise ValueError(
              "The ingress deployment to your application cannot be a function if there "
              "are multiple deployments. If you want to compose them, use a class. If "
              "you're using the DAG API, the function should be bound to a DAGDriver."
          )
  
      # After Ray DAG is transformed to Serve DAG with deployments and their init
      # args filled, generate a minimal weight executor serve dag for perf
      serve_executor_root_dag = serve_root_dag.apply_recursive(
          transform_serve_dag_to_serve_executor_dag
      )
      root_driver_deployment = deployments[-1]
      new_driver_deployment = generate_executor_dag_driver_deployment(
          serve_executor_root_dag, root_driver_deployment
      )
      # Replace DAGDriver deployment with executor DAGDriver deployment
      deployments[-1] = new_driver_deployment
      # Validate and only expose HTTP for the endpoint
      deployments_with_http = process_ingress_deployment_in_serve_dag(
          deployments
      )
  
      return deployments_with_http
  
imports: import inspect
  from collections import OrderedDict
  from typing import List
  from ray.dag import ClassNode, DAGNode
  from ray.dag.function_node import FunctionNode
  from ray.dag.utils import _DAGNodeNameGenerator
  from ray.experimental.gradio_utils import type_to_string
  from ray.serve._private.constants import RAY_SERVE_ENABLE_NEW_HANDLE_API, SERVE_DEFAULT_APP_NAME
  from ray.serve._private.deployment_executor_node import DeploymentExecutorNode
  from ray.serve._private.deployment_function_executor_node import DeploymentFunctionExecutorNode
  from ray.serve._private.deployment_function_node import DeploymentFunctionNode
  from ray.serve._private.deployment_node import DeploymentNode
  from ray.serve.deployment import Deployment, schema_to_deployment
  from ray.serve.handle import DeploymentHandle, RayServeHandle
  from ray.serve.schema import DeploymentSchema
label_desc: Use image node_id 1 for calling a global function with example usage: build(ray_dag_root_node, name) and returns: deployments_with_http