class_docstr: TFX infra validator executor.
class_docstr_tok: ["TFX","infra","validator","executor","."]
code: def _ValidateOnce(
      self,
      model_path: str,
      serving_binary: serving_bins.ServingBinary,
      serving_spec: infra_validator_pb2.ServingSpec,
      validation_spec: infra_validator_pb2.ValidationSpec,
      requests: List[iv_types.Request],
  ):
      deadline = time.time() + validation_spec.max_loading_time_seconds
      runner = _create_model_server_runner(
          model_path=model_path,
          serving_binary=serving_binary,
          serving_spec=serving_spec,
      )
  
      try:
          logging.info("Starting %r.", runner)
          runner.Start()
  
          # Check model is successfully loaded.
          runner.WaitUntilRunning(deadline)
          client = serving_binary.MakeClient(runner.GetEndpoint())
          client.WaitUntilModelLoaded(
              deadline,
              polling_interval_sec=_DEFAULT_POLLING_INTERVAL_SEC,
          )
  
          # Check model can be successfully queried.
          if requests:
              client.SendRequests(requests)
      except Exception:  # pylint: disable=broad-except
          logging.exception("Error occurred during infra validation.")
          maybe_logs = runner.GetLogs()
          if maybe_logs:
              logging.error(
                  "Fetching model server logs:\n"
                  "BEGIN_MODEL_SERVER_LOG\n"
                  "%s\n"
                  "END_MODEL_SERVER_LOG",
                  maybe_logs,
              )
          else:
              logging.error("No model server logs available.")
          raise
      finally:
          logging.info("Stopping %r.", runner)
          runner.Stop()
  
imports: import contextlib
  import functools
  import os
  import signal
  import threading
  import time
  from typing import Any, Dict, List, Optional
  from absl import logging
  from tfx import types
  from tfx.components.infra_validator import error_types
  from tfx.components.infra_validator import request_builder
  from tfx.components.infra_validator import serving_bins
  from tfx.components.infra_validator import types
  from tfx.components.infra_validator.model_server_runners import kubernetes_runner
  from tfx.components.infra_validator.model_server_runners import local_docker_runner
  from tfx.dsl.components.base import base_executor
  from tfx.proto import infra_validator_pb2
  from tfx.types import artifact_utils
  from tfx.types import standard_component_specs
  from tfx.utils import io_utils
  from tfx.utils import path_utils
  from tfx.utils import proto_utils
  from tfx.utils.model_paths import tf_serving_flavor
  from tensorflow_serving.apis import classification_pb2
  from tensorflow_serving.apis import predict_pb2
  from tensorflow_serving.apis import prediction_log_pb2
  from tensorflow_serving.apis import regression_pb2
label_desc: Use image node_id 10 for calling the Executor obj's underlying member method code with example usage: obj._ValidateOnce(model_path, serving_binary, serving_spec, validation_spec, requests) without return types