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

Method GetOrCreateDebugGrpcChannel

tensorflow/core/debug/debug_io_utils.cc:848–870  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

846}
847
848Status DebugGrpcIO::GetOrCreateDebugGrpcChannel(
849 const string& grpc_stream_url, DebugGrpcChannel** debug_grpc_channel) {
850 const string addr_with_path =
851 absl::StartsWith(grpc_stream_url, DebugIO::kGrpcURLScheme)
852 ? grpc_stream_url.substr(strlen(DebugIO::kGrpcURLScheme))
853 : grpc_stream_url;
854 const string server_stream_addr =
855 addr_with_path.substr(0, addr_with_path.find('/'));
856 {
857 mutex_lock l(streams_mu_);
858 std::unordered_map<string, std::unique_ptr<DebugGrpcChannel>>*
859 stream_channels = GetStreamChannels();
860 if (stream_channels->find(grpc_stream_url) == stream_channels->end()) {
861 std::unique_ptr<DebugGrpcChannel> channel(
862 new DebugGrpcChannel(server_stream_addr));
863 TF_RETURN_IF_ERROR(channel->Connect(channel_connection_timeout_micros_));
864 stream_channels->insert(
865 std::make_pair(grpc_stream_url, std::move(channel)));
866 }
867 *debug_grpc_channel = (*stream_channels)[grpc_stream_url].get();
868 }
869 return Status::OK();
870}
871
872Status DebugGrpcIO::SendEventProtoThroughGrpcStream(
873 const Event& event_proto, const string& grpc_stream_url,

Callers

nothing calls this directly

Calls 6

StartsWithFunction · 0.85
findMethod · 0.45
endMethod · 0.45
ConnectMethod · 0.45
insertMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected