diff --git a/tensorflow/core/distributed_runtime/rpc/grpc_server_lib.cc b/tensorflow/core/distributed_runtime/rpc/grpc_server_lib.cc index fb925e51497..395498cc61d 100644 --- a/tensorflow/core/distributed_runtime/rpc/grpc_server_lib.cc +++ b/tensorflow/core/distributed_runtime/rpc/grpc_server_lib.cc @@ -134,9 +134,9 @@ Status GrpcServer::GetHostAndPort(const ServerDef& server_def, if (job.name() == server_def.job_name()) { auto iter = job.tasks().find(server_def.task_index()); if (iter == job.tasks().end()) { - return errors::InvalidArgument("Task ", server_def.task_index(), - " was not defined in job \"", - server_def.job_name(), "\""); + return errors::Internal("Task ", server_def.task_index(), + " was not defined in job \"", + server_def.job_name(), "\""); } if (server_def.port() != 0) { diff --git a/tensorflow/core/distributed_runtime/rpc/grpc_server_lib.h b/tensorflow/core/distributed_runtime/rpc/grpc_server_lib.h index 1599575fab4..25a54fb13f9 100644 --- a/tensorflow/core/distributed_runtime/rpc/grpc_server_lib.h +++ b/tensorflow/core/distributed_runtime/rpc/grpc_server_lib.h @@ -136,6 +136,9 @@ class GrpcServer : public ServerInterface { // This method may only be called after `this->Init()` returns successfully. int bound_port() const { return bound_port_; } + // Returns hostname. + const string& host_name() const { return host_name_; } + const ServerDef& server_def() const { return server_def_; } GrpcWorker* worker_impl() const { return worker_impl_.get(); } GrpcWorkerEnv* grpc_worker_env() const { return grpc_worker_env_.get(); }