Use upstream URI in distributed quantile tests. (#7129)

* Use upstream URI in distributed quantile tests.

* Fix test cv `PytestAssertRewriteWarning`.
This commit is contained in:
Jiaming Yuan
2021-07-27 14:09:49 +08:00
committed by GitHub
parent e88ac9cc54
commit 7ee7a95b84
2 changed files with 12 additions and 4 deletions

View File

@@ -16,10 +16,18 @@ inline void InitRabitContext(std::string msg, int32_t n_workers) {
LOG(WARNING) << msg << " as `DMLC_TRACKER_PORT` is not set up.";
return;
}
auto uri = std::getenv("DMLC_TRACKER_URI");
std::string uri_str;
if (uri) {
uri_str = uri;
} else {
LOG(WARNING) << msg << " as `DMLC_TRACKER_URI` is not set up.";
return;
}
std::vector<std::string> envs{
"DMLC_TRACKER_PORT=" + port_str,
"DMLC_TRACKER_URI=127.0.0.1",
"DMLC_TRACKER_URI=" + uri_str,
"DMLC_NUM_WORKER=" + std::to_string(n_workers)};
char* c_envs[] {&(envs[0][0]), &(envs[1][0]), &(envs[2][0])};
rabit::Init(3, c_envs);