code: def get_component_id_from_execution(
      metadata_connection: metadata.Metadata,
      execution: metadata_store_pb2.Execution,
  ) -> str:
      """Get component_id without pipeline_name from a node context of execution."""
      contexts = metadata_connection.store.get_contexts_by_execution(
          execution.id
      )
  
      node_context_type = metadata_connection.store.get_context_type(
          compiler_constants.NODE_CONTEXT_TYPE_NAME
      )
      node_contexts = [
          c for c in contexts if c.type_id == node_context_type.id
      ]
      if len(node_contexts) != 1:
          raise ValueError(
              "Cannot find relevant context for execution:{}".format(
                  execution
              )
          )
      node_context = node_contexts[0]
      if "." not in node_context.name:
          raise ValueError(
              "Unexpected name of the node_context:{} for execution({})".format(
                  node_context, execution
              )
          )
      return node_context.name.split(".", 1)[1]
  
file_path: tfx/tfx/experimental/pipeline_testing/pipeline_recorder_utils.py
imports: import collections
  import os
  from typing import Iterable, List, Mapping, Optional, Tuple
  from absl import logging
  from tfx.dsl.compiler import constants
  from tfx.orchestration import metadata
  from tfx.utils import io_utils
  from ml_metadata.proto import metadata_store_pb2
label_desc: Use image node_id 1 for calling a global function with example usage: get_component_id_from_execution(metadata_connection, execution) and returns: node_context