code: def create_pipeline() -> pipeline_pb2.Pipeline:
      """Creates an async pipeline for testing."""
      # pylint: disable=no-value-for-parameter
      example_gen = _example_gen().with_id("my_example_gen")
  
      with for_each.ForEach(
          latest_created(example_gen.outputs["examples"], n=100)
      ) as examples:
          transform = _transform(examples=examples, a_param=10).with_id(
              "my_transform"
          )
      trainer = _trainer(
          examples=example_gen.outputs["examples"],
          transform_graph=transform.outputs["transform_graph"],
      ).with_id("my_trainer")
      # pylint: enable=no-value-for-parameter
  
      pipeline = pipeline_lib.Pipeline(
          pipeline_name="my_pipeline",
          pipeline_root="/path/to/root",
          components=[
              example_gen,
              transform,
              trainer,
          ],
          execution_mode=pipeline_lib.ExecutionMode.ASYNC,
      )
      dsl_compiler = compiler.Compiler(use_input_v2=True)
      compiled_pipeline: pipeline_pb2.Pipeline = dsl_compiler.compile(
          pipeline
      )
  
      # Compiler does not support setting min_count yet, so we mutate the proto
      # explicitly for testing.
      trainer = compiled_pipeline.nodes[2].pipeline_node
      assert trainer.node_info.id == "my_trainer"
      for value in trainer.inputs.inputs.values():
          value.min_count = 1
  
      return compiled_pipeline
  
file_path: tfx/tfx/orchestration/experimental/core/testing/test_async_pipeline.py
imports: from tfx.dsl.compiler import compiler
  from tfx.dsl.component.experimental.annotations import InputArtifact
  from tfx.dsl.component.experimental.annotations import OutputArtifact
  from tfx.dsl.component.experimental.annotations import Parameter
  from tfx.dsl.component.experimental.decorators import component
  from tfx.dsl.control_flow import for_each
  from tfx.dsl.input_resolution.canned_resolver_functions import latest_created
  from tfx.orchestration import pipeline
  from tfx.proto.orchestration import pipeline_pb2
  from tfx.types import standard_artifacts
label_desc: Use image node_id 4 for calling a global function with example usage: create_pipeline() and returns: compiled_pipeline