File tree Expand file tree Collapse file tree 4 files changed +19
-5
lines changed
tensorflow_serving/model_servers Expand file tree Collapse file tree 4 files changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -498,6 +498,7 @@ cc_library(
498498 "//tensorflow_serving/servables/tensorflow:thread_pool_factory_config_cc_proto" ,
499499 "//tensorflow_serving/servables/tensorflow:util" ,
500500 "//tensorflow_serving/util:proto_util" ,
501+ "@com_github_grpc_grpc//:grpc" ,
501502 "@com_github_grpc_grpc//:grpc++" ,
502503 "@com_google_absl//absl/memory" ,
503504 "@com_google_protobuf//:cc_wkt_protos" ,
Original file line number Diff line number Diff line change @@ -297,10 +297,12 @@ int main(int argc, char** argv) {
297297 " If non-empty, read an ascii ThreadPoolConfig protobuf "
298298 " from the supplied file name." ),
299299 tensorflow::Flag (" mixed_precision" , &options.mixed_precision ,
300- " specify mixed_precision mode" ),
300+ " specify mixed_precision mode" ),
301301 tensorflow::Flag (" skip_initialize_tpu" , &options.skip_initialize_tpu ,
302- " Whether to skip auto initializing TPU." )};
303-
302+ " Whether to skip auto initializing TPU." ),
303+ tensorflow::Flag (" enable_grpc_healthcheck_service" ,
304+ &options.enable_grpc_healthcheck_service ,
305+ " Enable the standard gRPC healthcheck service." )};
304306
305307 const auto & usage = tensorflow::Flags::Usage (argv[0 ], flag_list);
306308 if (!tensorflow::Flags::Parse (&argc, argv, flag_list)) {
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ limitations under the License.
2525
2626#include " google/protobuf/wrappers.pb.h"
2727#include " grpc/grpc.h"
28+ #include " grpcpp/health_check_service_interface.h"
2829#include " grpcpp/resource_quota.h"
2930#include " grpcpp/security/server_credentials.h"
3031#include " grpcpp/server_builder.h"
@@ -404,8 +405,17 @@ Status Server::BuildAndStart(const Options& server_options) {
404405 ::grpc::ResourceQuota res_quota;
405406 res_quota.SetMaxThreads (server_options.grpc_max_threads );
406407 builder.SetResourceQuota (res_quota);
407-
408+ ::grpc::EnableDefaultHealthCheckService (
409+ server_options.enable_grpc_healthcheck_service);
408410 grpc_server_ = builder.BuildAndStart ();
411+
412+ if (server_options.enable_grpc_healthcheck_service ) {
413+ grpc_server_->GetHealthCheckService ()->SetServingStatus (" ModelService" ,
414+ true );
415+ grpc_server_->GetHealthCheckService ()->SetServingStatus (" PredictionService" ,
416+ true );
417+ }
418+
409419 if (grpc_server_ == nullptr ) {
410420 return errors::InvalidArgument (" Failed to BuildAndStart gRPC server" );
411421 }
Original file line number Diff line number Diff line change @@ -103,7 +103,8 @@ class Server {
103103 bool enable_profiler = true ;
104104 tensorflow::string mixed_precision;
105105 bool skip_initialize_tpu = false ;
106-
106+ // Misc GRPC features
107+ bool enable_grpc_healthcheck_service = false ;
107108 Options ();
108109 };
109110
You can’t perform that action at this time.
0 commit comments