class_docstr: A model server client for TensorFlow Serving.
  
  It uses gRPC client to talk to TensorFlow Serving server.
docstr: Check whether the model is available for query or not.
  
  In TensorFlow Serving, model is READY if and only if the state from
  _GetModelStatus() is AVAILABLE. If returned state is END, it will never
  become READY therefore returns UNAVAILABLE. Otherwise it will return
  NOT_READY.
  
  Returns:
    A ModelState.
docstr_tok: ["Check","whether","the","model","is","available","for","query","or","not",".","In","TensorFlow","Serving",",","model","is","READY","if","and","only","if","the","state","from","_GetModelStatus","(",")","is","AVAILABLE",".","If","returned","state","is","END",",","it","will","never","become","READY","therefore","returns","UNAVAILABLE",".","Otherwise","it","will","return","NOT_READY",".","Returns",":","A","ModelState","."]
code: def _GetServingStatus(self) -> types.ModelServingStatus:
      """Check whether the model is available for query or not.
  
      In TensorFlow Serving, model is READY if and only if the state from
      _GetModelStatus() is AVAILABLE. If returned state is END, it will never
      become READY therefore returns UNAVAILABLE. Otherwise it will return
      NOT_READY.
  
      Returns:
        A ModelState.
      """
      try:
          resp = self._GetModelStatus()
      except grpc.RpcError as e:
          logging.info("Model status is not available yet:\n%s", e)
          return types.ModelServingStatus.NOT_READY
  
      # When no versions available. (empty list)
      if not resp.model_version_status:
          return types.ModelServingStatus.NOT_READY
  
      # Wait until all serving model versions are in AVAILABLE state.
      # In TensorFlow Serving, model state lifecycle is
      #     START -> LOADING -> AVAILABLE -> UNLOADING -> END
      # if loaded successfully or
      #     START -> LOADING -> END
      # if loaded unsuccessfully. The model is available iff state is AVAILABLE.
      # The model is unavailable for goods iff state is END.
      # https://github.com/tensorflow/serving/blob/master/tensorflow_serving/apis/get_model_status.proto
      if all(
          mvs.state == State.AVAILABLE
          for mvs in resp.model_version_status
      ):
          return types.ModelServingStatus.READY
      if any(
          mvs.state == State.END for mvs in resp.model_version_status
      ):
          return types.ModelServingStatus.UNAVAILABLE
      return types.ModelServingStatus.NOT_READY
  
file_path: tfx/tfx/components/infra_validator/model_server_clients/tensorflow_serving_client.py
imports: from absl import logging
  import grpc
  from tfx.components.infra_validator import types
  from tfx.components.infra_validator.model_server_clients import base_client
  from tensorflow_serving.apis import classification_pb2
  from tensorflow_serving.apis import model_pb2
  from tensorflow_serving.apis import predict_pb2
  from tensorflow_serving.apis import prediction_service_pb2_grpc
  from tensorflow_serving.apis import regression_pb2
label_desc: Use image node_id 3 for calling the TensorFlowServingClient obj's underlying member method code with example usage: obj._GetServingStatus() and returns: types, types, types, types, types