code: def set_execution_result(
      execution_result: execution_result_pb2.ExecutionResult,
      execution: metadata_store_pb2.Execution,
  ):
      """Sets execution result as a custom property of execution.
  
      Args:
        execution_result: The result of execution. It is typically generated by
          executor.
        execution: The execution to set to.
      """
      # TODO(b/161832842): Switch to PROTO value type to circumvent TypeError which
      # may be raised when converting embedded `Any` protos.
      try:
          execution.custom_properties[
              _EXECUTION_RESULT
          ].string_value = json_format.MessageToJson(execution_result)
      except TypeError:
          logging.exception(
              "Unable to set execution_result as custom property of the execution "
              "due to error, will attempt again by clearing `metadata_details`..."
          )
          try:
              execution_result = copy.deepcopy(execution_result)
              execution_result.ClearField("metadata_details")
              execution.custom_properties[
                  _EXECUTION_RESULT
              ].string_value = json_format.MessageToJson(
                  execution_result
              )
          except TypeError:
              logging.exception(
                  "Skipped setting execution_result as custom property of the "
                  "execution due to error"
              )
  
imports: from __future__ import annotations
  import collections
  import copy
  import itertools
  import re
  from typing import Any, Dict, Iterable, List, Mapping, Optional, Sequence, Tuple
  from absl import logging
  from tfx import types
  from tfx.orchestration import data_types_utils
  from tfx.orchestration import metadata
  from tfx.orchestration.portable import outputs_utils
  from tfx.orchestration.portable.mlmd import artifact_lib
  from tfx.orchestration.portable.mlmd import common_utils
  from tfx.orchestration.portable.mlmd import event_lib
  from tfx.orchestration.portable.mlmd import filter_query_builder
  from tfx.utils import metrics_utils
  from tfx.proto.orchestration import execution_result_pb2
  from tfx.proto.orchestration import pipeline_pb2
  from tfx.utils import proto_utils
  from tfx.utils import typing_utils
  from tfx.utils import telemetry_utils
  from google.protobuf import json_format
  import ml_metadata
  from ml_metadata.proto import metadata_store_pb2
label_desc: Use image node_id 25 for calling a global function with example usage: set_execution_result(execution_result, execution) without return types