MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / ToGrpcStatus

Function ToGrpcStatus

tensorflow/core/distributed_runtime/rpc/grpc_util.h:97–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95}
96
97inline ::grpc::Status ToGrpcStatus(const ::tensorflow::Status& s) {
98 if (s.ok()) {
99 return ::grpc::Status::OK;
100 } else {
101 if (s.error_message().size() > 3072 /* 3k bytes */) {
102 // TODO(b/62947679): Remove truncation once the gRPC issue is resolved.
103 string scratch =
104 strings::Printf("%.3072s ... [truncated]", s.error_message().c_str());
105 LOG(ERROR) << "Truncated error message: " << s;
106 return ::grpc::Status(static_cast<::grpc::StatusCode>(s.code()), scratch);
107 }
108 return ::grpc::Status(static_cast<::grpc::StatusCode>(s.code()),
109 s.error_message());
110 }
111}
112
113typedef std::shared_ptr<::grpc::Channel> SharedGrpcChannelPtr;
114

Callers 15

CreateMessageMethod · 0.85
DelegateRPCFunction · 0.85
RunGraphHandlerMethod · 0.85
RecvTensorHandlerRawMethod · 0.85
RecvBufHandlerMethod · 0.85
CompleteGroupHandlerMethod · 0.85
CreateSessionHandlerMethod · 0.85

Calls 6

PrintfFunction · 0.85
c_strMethod · 0.80
StatusClass · 0.50
okMethod · 0.45
sizeMethod · 0.45
codeMethod · 0.45

Tested by

no test coverage detected