code: def publish_failed_execution(
      metadata_handle: metadata.Metadata,
      contexts: Sequence[metadata_store_pb2.Context],
      execution_id: int,
      executor_output: Optional[
          execution_result_pb2.ExecutorOutput
      ] = None,
  ) -> None:
      """Marks an existing execution as failed.
  
      Args:
        metadata_handle: A handler to access MLMD.
        contexts: MLMD contexts to associated with the execution.
        execution_id: The id of the execution.
        executor_output: The output of executor.
      """
      [execution] = metadata_handle.store.get_executions_by_id(
          [execution_id]
      )
      execution.last_known_state = metadata_store_pb2.Execution.FAILED
      set_execution_result_if_not_empty(executor_output, execution)
  
      execution_lib.put_execution(metadata_handle, execution, contexts)
  
file_path: tfx/tfx/orchestration/portable/execution_publish_utils.py
imports: from typing import Mapping, Optional, Sequence
  import uuid
  from tfx import types
  from tfx.orchestration import data_types_utils
  from tfx.orchestration import metadata
  from tfx.orchestration.portable import merge_utils
  from tfx.orchestration.portable import outputs_utils
  from tfx.orchestration.portable.mlmd import execution_lib
  from tfx.proto.orchestration import execution_result_pb2
  from tfx.utils import typing_utils
  from ml_metadata.proto import metadata_store_pb2
label_desc: Use image node_id 4 for calling a global function with example usage: publish_failed_execution(metadata_handle, contexts, execution_id, executor_output) without return types