class_docstr: Allows previously-generated Artifacts to be used in a new pipeline run.
  
  By implementing this in a class (instead of a function), we reduce the
  number of MLMD reads when reusing the outputs of multiple nodes in the same
  pipeline run.
class_docstr_tok: ["Allows","previously-generated","Artifacts","to","be","used","in","a","new","pipeline","run",".","By","implementing","this","in","a","class","(","instead","of","a","function",")",",","we","reduce","the","number","of","MLMD","reads","when","reusing","the","outputs","of","multiple","nodes","in","the","same","pipeline","run","."]
code: def __init__(
      self,
      metadata_handle: metadata.Metadata,
      pipeline_name: str,
      new_run_id: str,
      base_run_id: Optional[str] = None,
  ):
      self._mlmd = metadata_handle
      self._pipeline_name: Final[str] = pipeline_name
      self._pipeline_context: Final[
          metadata_store_pb2.Context
      ] = context_lib.register_context_if_not_exists(
          self._mlmd,
          context_type_name=constants.PIPELINE_CONTEXT_TYPE_NAME,
          context_name=self._pipeline_name,
      )
      self._new_run_id: Final[str] = new_run_id
      self._new_pipeline_run_context: Final[
          metadata_store_pb2.Context
      ] = context_lib.register_context_if_not_exists(
          self._mlmd,
          context_type_name=constants.PIPELINE_RUN_CONTEXT_TYPE_NAME,
          context_name=self._new_run_id,
          parent_contexts=[self._pipeline_context],
      )
  
      self._base_run_context: Final[
          metadata_store_pb2.Context
      ] = self._get_base_pipeline_run_context(base_run_id)
  
      self._node_context_by_name: Final[
          Dict[str, metadata_store_pb2.Context]
      ] = {
          ctx.name: ctx
          for ctx in self._mlmd.store.get_contexts_by_type(
              constants.NODE_CONTEXT_TYPE_NAME
          )
      }
  
imports: import collections
  import concurrent.futures
  import enum
  from typing import Collection, Dict, Final, List, Mapping, Optional, OrderedDict, Sequence, Set, Tuple
  import uuid
  from absl import logging
  from tfx.dsl.compiler import compiler_utils
  from tfx.dsl.compiler import constants
  from tfx.orchestration import metadata
  from tfx.orchestration import node_proto_view
  from tfx.orchestration.portable import execution_publish_utils
  from tfx.orchestration.portable.mlmd import context_lib
  from tfx.orchestration.portable.mlmd import execution_lib
  from tfx.proto.orchestration import pipeline_pb2
  from ml_metadata.proto import metadata_store_pb2
label_desc: Use image node_id 1 to create a new _ArtifactRecycler object  with example: obj = _ArtifactRecycler(metadata_handle, pipeline_name, new_run_id, base_run_id)