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

Method CleanupWorkers

tensorflow/core/distributed_runtime/master.cc:622–652  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

620}
621
622void Master::CleanupWorkers(const ResetRequest& reset) {
623 std::vector<string> worker_names;
624 DeviceFinder::GetRemoteWorkers(reset.device_filters(), env_,
625 env_->worker_cache, &worker_names);
626 if (!worker_names.empty()) {
627 const int num_workers = worker_names.size();
628 std::vector<Notification> n(num_workers);
629 CleanupAllRequest req;
630 (*req.mutable_container()) = reset.container();
631 std::vector<CleanupAllResponse> resp(num_workers);
632 int c = 0;
633 for (int i = 0; i < num_workers; ++i) {
634 const string& worker_name = worker_names[i];
635 auto worker = env_->worker_cache->GetOrCreateWorker(worker_name);
636 if (worker) {
637 worker->CleanupAllAsync(
638 &req, &resp[i], [this, &n, worker_name, worker, c](Status s) {
639 TF_CHECK_OK(s);
640 env_->worker_cache->ReleaseWorker(worker_name, worker);
641 n[c].Notify();
642 });
643 } else {
644 n[c].Notify();
645 }
646 ++c;
647 }
648 for (size_t i = 0; i < n.size(); ++i) {
649 n[i].WaitForNotification();
650 }
651 }
652}
653
654void Master::Reset(const ResetRequest* req, ResetResponse* resp,
655 MyClosure done) {

Callers

nothing calls this directly

Calls 8

emptyMethod · 0.45
sizeMethod · 0.45
containerMethod · 0.45
GetOrCreateWorkerMethod · 0.45
CleanupAllAsyncMethod · 0.45
ReleaseWorkerMethod · 0.45
NotifyMethod · 0.45
WaitForNotificationMethod · 0.45

Tested by

no test coverage detected