class_docstr: Launcher is the main entrance of nodes in TFleX.
  
  It handles TFX internal details like artifact resolving, execution
  triggering and result publishing.
class_docstr_tok: ["Launcher","is","the","main","entrance","of","nodes","in","TFleX",".","It","handles","TFX","internal","details","like","artifact","resolving",",","execution","triggering","and","result","publishing","."]
docstr: Registers or reuses an execution in MLMD.
code: def _register_or_reuse_execution(
      self,
      metadata_handle: metadata.Metadata,
      contexts: List[metadata_store_pb2.Context],
      input_artifacts: Optional[typing_utils.ArtifactMultiMap] = None,
      exec_properties: Optional[Mapping[str, types.Property]] = None,
  ) -> metadata_store_pb2.Execution:
      """Registers or reuses an execution in MLMD."""
      executions = (
          execution_lib.get_executions_associated_with_all_contexts(
              metadata_handle, contexts
          )
      )
      if len(executions) > 1:
          raise RuntimeError(
              "Expecting no more than one previous executions for"
              "the associated contexts"
          )
      elif executions:
          execution = executions.pop()
          if execution_lib.is_execution_successful(execution):
              logging.warning(
                  "This execution has already succeeded. Will exit "
                  "gracefully to avoid overwriting output artifacts."
              )
          elif not execution_lib.is_execution_active(execution):
              logging.warning(
                  "Expected execution to be in state NEW or RUNNING. Actual state: "
                  "%s. Output artifacts may be overwritten.",
                  execution.last_known_state,
              )
          return execution
      return _register_execution(
          metadata_handle=metadata_handle,
          execution_type=self._pipeline_node.node_info.type,
          contexts=contexts,
          input_artifacts=input_artifacts,
          exec_properties=exec_properties,
      )
  
imports: import sys
  from typing import Any, Dict, List, Mapping, Optional, Type, TypeVar
  from absl import logging
  import attr
  import grpc
  import portpicker
  from tfx import types
  from tfx.dsl.compiler import placeholder_utils
  from tfx.dsl.io import fileio
  from tfx.orchestration import data_types_utils
  from tfx.orchestration import metadata
  from tfx.orchestration.portable import base_driver_operator
  from tfx.orchestration.portable import base_executor_operator
  from tfx.orchestration.portable import beam_executor_operator
  from tfx.orchestration.portable import cache_utils
  from tfx.orchestration.portable import data_types
  from tfx.orchestration.portable import docker_executor_operator
  from tfx.orchestration.portable import execution_publish_utils
  from tfx.orchestration.portable import execution_watcher
  from tfx.orchestration.portable import importer_node_handler
  from tfx.orchestration.portable import inputs_utils
  from tfx.orchestration.portable import outputs_utils
  from tfx.orchestration.portable import python_driver_operator
  from tfx.orchestration.portable import python_executor_operator
  from tfx.orchestration.portable import resolver_node_handler
  from tfx.orchestration.portable.input_resolution import exceptions
  from tfx.orchestration.portable.mlmd import context_lib
  from tfx.orchestration.portable.mlmd import execution_lib
  from tfx.proto.orchestration import driver_output_pb2
  from tfx.proto.orchestration import executable_spec_pb2
  from tfx.proto.orchestration import execution_result_pb2
  from tfx.proto.orchestration import pipeline_pb2
  from tfx.utils import typing_utils
  from google.protobuf import message
  from ml_metadata.proto import metadata_store_pb2
label_desc: Use image node_id 2 for calling the Launcher obj's underlying member method code with example usage: obj._register_or_reuse_execution(metadata_handle, contexts, input_artifacts, exec_properties) and returns: _register_execution, execution