Class ServerHealthContext

Class Documentation

class ServerHealthContext

A ServerHealthContext object is used to query an inference server for health information.

Once created a ServerHealthContext object can be used repeatedly to get health from the server. A ServerHealthContext object can use either HTTP protocol or GRPC protocol depending on the Create function (ServerHealthHttpContext::Create or ServerHealthGrpcContext::Create). For example:

std::unique_ptr<ServerHealthContext> ctx;
  ServerHealthHttpContext::Create(&ctx, "localhost:8000");
  bool ready;
  ctx->GetReady(&ready);
  ...
  bool live;
  ctx->GetLive(&live);
  ...

Note

ServerHealthContext::Create methods are thread-safe. GetReady() and GetLive() are not thread-safe. For a given ServerHealthContext, calls to GetReady() and GetLive() must be serialized.

Public Functions

virtual ~ServerHealthContext() = 0
virtual Error GetReady(bool *ready) = 0

Contact the inference server and get readiness state.

Return

Error object indicating success or failure of the request.

Parameters
  • ready: Returns the readiness state of the server.

virtual Error GetLive(bool *live) = 0

Contact the inference server and get liveness state.

Return

Error object indicating success or failure of the request.

Parameters
  • ready: Returns the liveness state of the server.