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

Method ParseKey

tensorflow/core/framework/rendezvous.cc:86–113  ·  view source on GitHub ↗

static */

Source from the content-addressed store, hash-verified

84
85/* static */
86Status Rendezvous::ParseKey(StringPiece key, ParsedKey* out) {
87 if (key.data() == out->buf_.data()) {
88 // Caller used our buf_ string directly, so we don't need to copy. (The
89 // SendOp and RecvOp implementations do this, for example).
90 DCHECK_EQ(key.size(), out->buf_.size());
91 } else {
92 // Make a copy that our StringPieces can point at a copy that will persist
93 // for the lifetime of the ParsedKey object.
94 out->buf_.assign(key.data(), key.size());
95 }
96 StringPiece s(out->buf_);
97 StringPiece parts[5];
98 for (int i = 0; i < 5; i++) {
99 parts[i] = ConsumeNextPart(&s, ';');
100 }
101 if (s.empty() && // Consumed the whole string
102 !parts[4].empty() && // Exactly five parts
103 DeviceNameUtils::ParseFullName(parts[0], &out->src) &&
104 strings::HexStringToUint64(parts[1], &out->src_incarnation) &&
105 DeviceNameUtils::ParseFullName(parts[2], &out->dst) &&
106 !parts[3].empty()) {
107 out->src_device = StringPiece(parts[0].data(), parts[0].size());
108 out->dst_device = StringPiece(parts[2].data(), parts[2].size());
109 out->edge_name = StringPiece(parts[3].data(), parts[3].size());
110 return Status::OK();
111 }
112 return errors::InvalidArgument("Invalid rendezvous key: ", key);
113}
114
115Rendezvous::~Rendezvous() {}
116

Callers

nothing calls this directly

Calls 7

ConsumeNextPartFunction · 0.85
HexStringToUint64Function · 0.85
InvalidArgumentFunction · 0.85
dataMethod · 0.45
sizeMethod · 0.45
assignMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected