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","."]
docstr: Returns node context for node.
docstr_tok: ["Returns","node","context","for","node","."]
code: def _get_node_context(
      self, node: node_proto_view.NodeProtoView
  ) -> metadata_store_pb2.Context:
      """Returns node context for node."""
      node_id = node.node_info.id
      # Return the end node context if we want to reuse a subpipeline. We do this
      # because nodes dependent on a subpipeline use the subpipeline's end node
      # to get their aritfacts from, so we reuse those artifacts.
      if isinstance(node, node_proto_view.ComposablePipelineProtoView):
          context_name = (
              compiler_utils.end_node_context_name_from_subpipeline_id(
                  node_id
              )
          )
      else:
          context_name = compiler_utils.node_context_name(
              self._pipeline_name, node_id
          )
      node_context = self._node_context_by_name.get(context_name)
      if node_context is None:
          raise LookupError(
              f"node context {context_name} not found in MLMD."
          )
      return node_context
  
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 3 for calling the _ArtifactRecycler obj's underlying member method code with example usage: obj._get_node_context(node) and returns: node_context