code: def main(argv):
      # Log to the container's stdout so Kubeflow Pipelines UI can display logs to
      # the user.
      logging.basicConfig(stream=sys.stdout, level=logging.INFO)
      logging.getLogger().setLevel(logging.INFO)
  
      parser = argparse.ArgumentParser()
      parser.add_argument("--pipeline_root", type=str, required=True)
      parser.add_argument(
          "--metadata_ui_path",
          type=str,
          required=False,
          default="/mlpipeline-ui-metadata.json",
      )
      parser.add_argument(
          "--kubeflow_metadata_config", type=str, required=True
      )
      parser.add_argument("--tfx_ir", type=str, required=True)
      parser.add_argument("--node_id", type=str, required=True)
      # There might be multiple runtime parameters.
      # `args.runtime_parameter` should become List[str] by using "append".
      parser.add_argument(
          "--runtime_parameter", type=str, action="append"
      )
  
      # TODO(b/196892362): Replace hooking with a more straightforward mechanism.
      launcher._register_execution = (
          _register_execution  # pylint: disable=protected-access
      )
  
      args = parser.parse_args(argv)
  
      tfx_ir = pipeline_pb2.Pipeline()
      json_format.Parse(args.tfx_ir, tfx_ir)
  
      _resolve_runtime_parameters(tfx_ir, args.runtime_parameter)
  
      deployment_config = runner_utils.extract_local_deployment_config(
          tfx_ir
      )
  
      kubeflow_metadata_config = kubeflow_pb2.KubeflowMetadataConfig()
      json_format.Parse(
          args.kubeflow_metadata_config, kubeflow_metadata_config
      )
      metadata_connection = metadata.Metadata(
          _get_metadata_connection_config(kubeflow_metadata_config)
      )
  
      node_id = args.node_id
      # Attach necessary labels to distinguish different runner and DSL.
      # TODO(zhitaoli): Pass this from KFP runner side when the same container
      # entrypoint can be used by a different runner.
      with telemetry_utils.scoped_labels(
          {
              telemetry_utils.LABEL_TFX_RUNNER: "kfp",
          }
      ):
          custom_executor_operators = {
              executable_spec_pb2.ContainerExecutableSpec: kubernetes_executor_operator.KubernetesExecutorOperator
          }
  
          executor_spec = runner_utils.extract_executor_spec(
              deployment_config, node_id
          )
          custom_driver_spec = runner_utils.extract_custom_driver_spec(
              deployment_config, node_id
          )
  
          pipeline_node = _get_pipeline_node(tfx_ir, node_id)
          component_launcher = launcher.Launcher(
              pipeline_node=pipeline_node,
              mlmd_connection=metadata_connection,
              pipeline_info=tfx_ir.pipeline_info,
              pipeline_runtime_spec=tfx_ir.runtime_spec,
              executor_spec=executor_spec,
              custom_driver_spec=custom_driver_spec,
              custom_executor_operators=custom_executor_operators,
          )
          logging.info("Component %s is running.", node_id)
          execution_info = component_launcher.launch()
          logging.info("Component %s is finished.", node_id)
  
      # Dump the UI metadata.
      _dump_ui_metadata(
          pipeline_node, execution_info, args.metadata_ui_path
      )
  
imports: import argparse
  import copy
  import json
  import logging
  import os
  import sys
  import textwrap
  from typing import cast, Dict, List, Mapping, MutableMapping, Optional, Sequence, Tuple, Union
  from tfx import types
  from tfx.dsl.compiler import constants
  from tfx.orchestration import metadata
  from tfx.orchestration.kubeflow.proto import kubeflow_pb2
  from tfx.orchestration.local import runner_utils
  from tfx.orchestration.portable import data_types
  from tfx.orchestration.portable import execution_publish_utils
  from tfx.orchestration.portable import kubernetes_executor_operator
  from tfx.orchestration.portable import launcher
  from tfx.orchestration.portable import runtime_parameter_utils
  from tfx.proto.orchestration import executable_spec_pb2
  from tfx.proto.orchestration import pipeline_pb2
  from tfx.types import artifact
  from tfx.types import channel
  from tfx.types import standard_artifacts
  from tfx.utils import telemetry_utils
  from google.protobuf import json_format
  from ml_metadata.proto import metadata_store_pb2
label_desc: Use image node_id 12 for calling a global function with example usage: main(argv) without return types