未验证 提交 fd616fad 编写于 作者: T tangwei12 提交者: GitHub

repen heartbeat ut (#27684)

上级 f373269d
......@@ -84,7 +84,7 @@ void HeartBeatMonitor::LostWorkerMonitor() {
}
}
std::this_thread::sleep_for(std::chrono::milliseconds(30 * 1000));
std::this_thread::sleep_for(std::chrono::milliseconds(10 * 1000));
}
VLOG(1) << "worker heartbeat monitor stopped, thread exit";
}
......
......@@ -23,32 +23,30 @@ namespace distributed {
void run(HeartBeatMonitor* monitor) { monitor->LostWorkerMonitor(); }
TEST(HeartBeatMonitor, All) {
// (tangwei12) fix it soon.
return;
// int trainers = 10;
// int pserver_id = 0;
// std::string var = "nce_w@GRAD.block0";
// std::string var2 = "nce_w@GRAD.block2";
//
// HeartBeatMonitor::Init(trainers, pserver_id == 0, var);
//
// auto* monitor = HeartBeatMonitor::GetInstance();
//
// std::vector<int> ids{1, 3, 5, 7};
//
// for (auto& id : ids) {
// monitor->Update(id, var, RUNNING);
// }
//
// monitor->Update(9, var2, RUNNING);
// monitor->Update(2, var, COMPLETED);
//
// std::thread t(run, monitor);
// t.detach();
//
// std::this_thread::sleep_for(std::chrono::milliseconds(45 * 1000));
//
// monitor->Stop();
int trainers = 10;
int pserver_id = 0;
std::string var = "nce_w@GRAD.block0";
std::string var2 = "nce_w@GRAD.block2";
HeartBeatMonitor::Init(trainers, pserver_id == 0, var);
auto* monitor = HeartBeatMonitor::GetInstance();
std::vector<int> ids{1, 3, 5, 7};
for (auto& id : ids) {
monitor->Update(id, var, RUNNING);
}
monitor->Update(9, var2, RUNNING);
monitor->Update(2, var, COMPLETED);
std::thread t(run, monitor);
t.detach();
std::this_thread::sleep_for(std::chrono::milliseconds(15 * 1000));
monitor->Stop();
}
} // namespace distributed
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册