class_docstr: Base class for all RequestBuilders.
class_docstr_tok: ["Base","class","for","all","RequestBuilders","."]
docstr: Read records from Examples artifact.
  
  Currently it assumes Examples artifact contains serialized tf.Example in
  gzipped TFRecord files.
  
  Args:
    examples: `Examples` artifact.
    num_examples: Number of examples to read. If the specified value is larger
        than the actual number of examples, all examples would be read.
    split_name: Name of the split to read from the Examples artifact.
  
  Raises:
    RuntimeError: If read twice.
docstr_tok: ["Read","records","from","Examples","artifact",".","Currently","it","assumes","Examples","artifact","contains","serialized","tf.Example","in","gzipped","TFRecord","files",".","Args",":","examples",":","`","Examples","`","artifact",".","num_examples",":","Number","of","examples","to","read",".","If","the","specified","value","is","larger","than","the","actual","number","of","examples",",","all","examples","would","be","read",".","split_name",":","Name","of","the","split","to","read","from","the","Examples","artifact",".","Raises",":","RuntimeError",":","If","read","twice","."]
code: def ReadExamplesArtifact(
      self,
      examples: types.Artifact,
      num_examples: int,
      split_name: Optional[str] = None,
  ):
      """Read records from Examples artifact.
  
      Currently it assumes Examples artifact contains serialized tf.Example in
      gzipped TFRecord files.
  
      Args:
        examples: `Examples` artifact.
        num_examples: Number of examples to read. If the specified value is larger
            than the actual number of examples, all examples would be read.
        split_name: Name of the split to read from the Examples artifact.
  
      Raises:
        RuntimeError: If read twice.
      """
      if self._records:
          raise RuntimeError("Cannot read records twice.")
  
      if num_examples < 1:
          raise ValueError(
              "num_examples < 1 (got {})".format(num_examples)
          )
  
      available_splits = artifact_utils.decode_split_names(
          examples.split_names
      )
      if not available_splits:
          raise ValueError(
              "No split_name is available in given Examples artifact."
          )
      if split_name is None:
          split_name = available_splits[0]
      if split_name not in available_splits:
          raise ValueError(
              "No split_name {}; available split names: {}".format(
                  split_name, ", ".join(available_splits)
              )
          )
  
      # ExampleGen generates artifacts under each split_name directory.
      glob_pattern = os.path.join(
          artifact_utils.get_split_uri([examples], split_name), "*"
      )
      tfxio_factory = tfxio_utils.get_tfxio_factory_from_artifact(
          examples=[examples],
          telemetry_descriptors=_TELEMETRY_DESCRIPTORS,
          schema=None,
          read_as_raw_records=True,
          raw_record_column_name=_RAW_RECORDS_COLUMN,
      )
      filenames = fileio.glob(glob_pattern)
      if not filenames:
          raise ValueError(
              "Unable to find examples matching {}.".format(
                  glob_pattern
              )
          )
  
      self._payload_format = examples_utils.get_payload_format(examples)
      tfxio = tfxio_factory(filenames)
  
      self._ReadFromDataset(
          tfxio.TensorFlowDataset(
              dataset_options.TensorFlowDatasetOptions(
                  batch_size=num_examples
              )
          )
      )
  
imports: import abc
  import os
  from typing import Any, Iterable, List, Mapping, Optional
  from absl import logging
  import tensorflow
  from tfx import types
  from tfx.components.infra_validator import types
  from tfx.components.util import examples_utils
  from tfx.components.util import tfxio_utils
  from tfx.dsl.io import fileio
  from tfx.proto import example_gen_pb2
  from tfx.proto import infra_validator_pb2
  from tfx.types import artifact_utils
  from tfx.utils import path_utils
  from tfx_bsl.tfxio import dataset_options
  from tensorflow.python.saved_model import loader_impl
  from tensorflow_serving.apis import classification_pb2
  from tensorflow_serving.apis import predict_pb2
  from tensorflow_serving.apis import regression_pb2
label_desc: Use image node_id 2 for calling the _BaseRequestBuilder obj's underlying member method code with example usage: obj.ReadExamplesArtifact(examples, num_examples, split_name) without return types