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

Method WhenDone

tensorflow/core/common_runtime/executor.h:221–265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

219 StatusGroup status_group_ TF_GUARDED_BY(mu_);
220
221 void WhenDone(const Status& s) {
222 Rendezvous* error_rendez = nullptr;
223 StatusCallback done = nullptr;
224 Status status;
225
226 {
227 mutex_lock l(mu_);
228
229 // If we are the first error encountered, trigger an abort of the
230 // Rendezvous object by this thread only.
231 if (status_group_.ok() && !s.ok()) {
232 error_rendez = rendez_;
233 error_rendez->Ref();
234 }
235
236 if (!s.ok() && !StatusGroup::IsDerived(s) &&
237 !status_group_.HasLogMessages()) {
238 status_group_.AttachLogMessages();
239 }
240
241 status_group_.Update(s);
242
243 // If this is the last call to WhenDone, call the final callback
244 // below.
245 if (--pending_ == 0) {
246 CHECK(done_cb_ != nullptr);
247 std::swap(done, done_cb_);
248 status = status_group_.as_summary_status();
249 }
250 }
251
252 if (error_rendez != nullptr) {
253 error_rendez->StartAbort(
254 errors::Aborted("Stopping remaining executors."));
255 error_rendez->Unref();
256 }
257
258 if (done != nullptr) {
259 delete this;
260 if (!status.ok()) {
261 VLOG(1) << "ExecutorBarrier finished with bad status: " << status;
262 }
263 done(status);
264 }
265 }
266
267 TF_DISALLOW_COPY_AND_ASSIGN(ExecutorBarrier);
268};

Callers

nothing calls this directly

Calls 8

HasLogMessagesMethod · 0.80
AttachLogMessagesMethod · 0.80
as_summary_statusMethod · 0.80
okMethod · 0.45
RefMethod · 0.45
UpdateMethod · 0.45
StartAbortMethod · 0.45
UnrefMethod · 0.45

Tested by

no test coverage detected