Allow child class of Server to supply custom ChannelArguments

PiperOrigin-RevId: 209685137
This commit is contained in:
Noah Eisen 2018-08-21 16:58:59 -07:00 committed by TensorFlower Gardener
parent 3cb13feff0
commit 95d718a8a4
2 changed files with 5 additions and 0 deletions

View File

@ -190,6 +190,8 @@ Status GrpcServer::Init(
builder.SetMaxMessageSize(std::numeric_limits<int32>::max());
builder.SetOption(
std::unique_ptr<::grpc::ServerBuilderOption>(new NoReusePortOption));
// Allow subclasses to specify more args to pass to the gRPC server.
MaybeMutateBuilder(&builder);
master_impl_ = CreateMaster(&master_env_);
master_service_ = NewGrpcMasterService(master_impl_.get(), config, &builder);
worker_impl_ =

View File

@ -59,6 +59,9 @@ typedef std::function<std::unique_ptr<GrpcWorker>(WorkerEnv*)>
class GrpcServer : public ServerInterface {
protected:
GrpcServer(const ServerDef& server_def, Env* env);
// Allow children classes to override this and provide custom args to the
// server before it is constructed. Default behavior is to do nothing.
virtual void MaybeMutateBuilder(::grpc::ServerBuilder* builder) {}
public:
static Status Create(const ServerDef& server_def, Env* env,