code: def run_python_custom_component(
      executable_spec: Union[
          _PythonClassExecutableSpec, _BeamExecutableSpec
      ],
      execution_info: data_types.ExecutionInfo,
      mlmd_connection_config: Optional[
          metadata.ConnectionConfigType
      ] = None,
  ) -> None:
      """Run Python custom component declared with @component decorator."""
      # MLMD connection config being set indicates a driver execution instead of an
      # executor execution as accessing MLMD is not supported for executors.
      if mlmd_connection_config:
          run_result = _run_driver(
              executable_spec, mlmd_connection_config, execution_info
          )
      else:
          run_result = python_executor_operator_dispatcher.run_executor(
              executable_spec, execution_info
          )
  
      if run_result:
          with fileio.open(
              execution_info.execution_output_uri, "wb"
          ) as f:
              f.write(run_result.SerializeToString())
  
file_path: tfx/tfx/orchestration/python_execution_binary/python_execution_lib.py
imports: from typing import Optional, Union
  from absl import logging
  from tfx.dsl.io import fileio
  from tfx.orchestration import metadata
  from tfx.orchestration.portable import data_types
  from tfx.orchestration.portable import python_driver_operator
  from tfx.proto.orchestration import driver_output_pb2
  from tfx.proto.orchestration import executable_spec_pb2
  from tfx.orchestration.python_execution_binary import python_executor_operator_dispatcher
label_desc: Use image node_id 2 for calling a global function with example usage: run_python_custom_component(executable_spec, execution_info, mlmd_connection_config) without return types