Edit according to PR comments

This commit is contained in:
Fei Sun 2020-04-29 10:35:01 +08:00
parent 966ed1cafc
commit 3a8b6ba5c1
2 changed files with 7 additions and 5 deletions
tensorflow/core/distributed_runtime/rpc

View File

@ -132,7 +132,9 @@ GrpcServer::~GrpcServer() {
void GrpcServer::MaybeMutateBuilder(::grpc::ServerBuilder* builder) {}
// Look up the port that has been requested for this task in `server_def`.
Status GrpcServer::GetHostAndPort(const ServerDef& server_def, string* host_name, int* port) const {
Status GrpcServer::GetHostAndPort(const ServerDef& server_def,
string* host_name,
int* port) const {
*port = -1;
*host_name = "localhost";
for (const auto& job : server_def.cluster().job()) {
@ -180,9 +182,7 @@ Status GrpcServer::Init(const GrpcServerOptions& opts) {
// otherwise if 'task_index=-1' the program will abort.
int requested_port;
string host_name;
TF_RETURN_IF_ERROR(GetHostAndPort(server_def_, &host_name, &requested_port));
host_name_ = host_name;
TF_RETURN_IF_ERROR(GetHostAndPort(server_def_, &host_name_, &requested_port));
SessionOptions sess_opts;
ConfigProto config = server_def_.default_session_config();

View File

@ -104,7 +104,9 @@ class GrpcServer : public ServerInterface {
Status UpdateServerDef(const ServerDef& server_def);
protected:
virtual Status GetHostAndPort(const ServerDef& server_def, string* host_name, int* port) const;
virtual Status GetHostAndPort(const ServerDef& server_def,
string* host_name,
int* port) const;
Status Init(const GrpcServerOptions& opts = GrpcServerOptions());
// A subclass can override this method to support secure credentials.