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(
498
498
"//tensorflow_serving/servables/tensorflow:thread_pool_factory_config_cc_proto" ,
499
499
"//tensorflow_serving/servables/tensorflow:util" ,
500
500
"//tensorflow_serving/util:proto_util" ,
501
+ "@com_github_grpc_grpc//:grpc" ,
501
502
"@com_github_grpc_grpc//:grpc++" ,
502
503
"@com_google_absl//absl/memory" ,
503
504
"@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) {
297
297
" If non-empty, read an ascii ThreadPoolConfig protobuf "
298
298
" from the supplied file name." ),
299
299
tensorflow::Flag (" mixed_precision" , &options.mixed_precision ,
300
- " specify mixed_precision mode" ),
300
+ " specify mixed_precision mode" ),
301
301
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." )};
304
306
305
307
const auto & usage = tensorflow::Flags::Usage (argv[0 ], flag_list);
306
308
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.
25
25
26
26
#include " google/protobuf/wrappers.pb.h"
27
27
#include " grpc/grpc.h"
28
+ #include " grpcpp/health_check_service_interface.h"
28
29
#include " grpcpp/resource_quota.h"
29
30
#include " grpcpp/security/server_credentials.h"
30
31
#include " grpcpp/server_builder.h"
@@ -404,8 +405,17 @@ Status Server::BuildAndStart(const Options& server_options) {
404
405
::grpc::ResourceQuota res_quota;
405
406
res_quota.SetMaxThreads (server_options.grpc_max_threads );
406
407
builder.SetResourceQuota (res_quota);
407
-
408
+ ::grpc::EnableDefaultHealthCheckService (
409
+ server_options.enable_grpc_healthcheck_service);
408
410
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
+
409
419
if (grpc_server_ == nullptr ) {
410
420
return errors::InvalidArgument (" Failed to BuildAndStart gRPC server" );
411
421
}
Original file line number Diff line number Diff line change @@ -103,7 +103,8 @@ class Server {
103
103
bool enable_profiler = true ;
104
104
tensorflow::string mixed_precision;
105
105
bool skip_initialize_tpu = false ;
106
-
106
+ // Misc GRPC features
107
+ bool enable_grpc_healthcheck_service = false ;
107
108
Options ();
108
109
};
109
110
You can’t perform that action at this time.
0 commit comments