code: def _validate_pipeline(
      tfx_pipeline: pipeline.Pipeline,
      parent_pipelines: List[pipeline.Pipeline],
  ):
      """Performs pre-compile validations."""
      if tfx_pipeline.execution_mode == pipeline.ExecutionMode.ASYNC:
          if compiler_utils.has_task_dependency(tfx_pipeline):
              raise ValueError(
                  "Task dependency is not supported in ASYNC mode."
              )
  
          if compiler_utils.has_resolver_node(tfx_pipeline):
              raise ValueError(
                  "Resolver nodes can not be used in ASYNC mode. Use resolver "
                  "functions instead."
              )
  
      if not compiler_utils.ensure_topological_order(
          tfx_pipeline.components
      ):
          raise ValueError(
              "Pipeline components are not topologically sorted."
          )
  
      if (
          parent_pipelines
          and tfx_pipeline.execution_mode != pipeline.ExecutionMode.SYNC
      ):
          raise ValueError("Subpipeline has to be Sync execution mode.")
  
imports: import itertools
  from typing import Any, Callable, Dict, Iterator, List, Optional, Tuple, Type, cast
  from tfx import types
  from tfx.dsl.compiler import compiler_context
  from tfx.dsl.compiler import compiler_utils
  from tfx.dsl.compiler import constants
  from tfx.dsl.compiler import node_inputs_compiler
  from tfx.dsl.components.base import base_component
  from tfx.dsl.components.base import base_driver
  from tfx.dsl.components.base import base_node
  from tfx.dsl.experimental.node_execution_options import utils
  from tfx.dsl.placeholder import placeholder
  from tfx.orchestration import data_types
  from tfx.orchestration import data_types_utils
  from tfx.orchestration import pipeline
  from tfx.proto.orchestration import executable_spec_pb2
  from tfx.proto.orchestration import pipeline_pb2
  from tfx.types import channel
  from tfx.types import channel_utils
  from tfx.utils import deprecation_utils
  from tfx.utils import name_utils
label_desc: Use image node_id 2 for calling a global function with example usage: _validate_pipeline(tfx_pipeline, parent_pipelines) without return types