Use upstream URI in distributed quantile tests. (#7129)
* Use upstream URI in distributed quantile tests. * Fix test cv `PytestAssertRewriteWarning`.
This commit is contained in:
parent
e88ac9cc54
commit
7ee7a95b84
@ -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.";
|
LOG(WARNING) << msg << " as `DMLC_TRACKER_PORT` is not set up.";
|
||||||
return;
|
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{
|
std::vector<std::string> envs{
|
||||||
"DMLC_TRACKER_PORT=" + port_str,
|
"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)};
|
"DMLC_NUM_WORKER=" + std::to_string(n_workers)};
|
||||||
char* c_envs[] {&(envs[0][0]), &(envs[1][0]), &(envs[2][0])};
|
char* c_envs[] {&(envs[0][0]), &(envs[1][0]), &(envs[2][0])};
|
||||||
rabit::Init(3, c_envs);
|
rabit::Init(3, c_envs);
|
||||||
|
|||||||
@ -136,9 +136,9 @@ class TestRanking:
|
|||||||
cv = xgboost.cv(self.params, self.dtrain, num_boost_round=2500,
|
cv = xgboost.cv(self.params, self.dtrain, num_boost_round=2500,
|
||||||
early_stopping_rounds=10, nfold=10, as_pandas=False)
|
early_stopping_rounds=10, nfold=10, as_pandas=False)
|
||||||
assert isinstance(cv, dict)
|
assert isinstance(cv, dict)
|
||||||
assert (set(cv.keys()) == {'test-ndcg-mean', 'train-ndcg-mean', 'test-ndcg-std',
|
assert set(cv.keys()) == {
|
||||||
'train-ndcg-std'},
|
'test-ndcg-mean', 'train-ndcg-mean', 'test-ndcg-std', 'train-ndcg-std'
|
||||||
'CV results dict key mismatch.')
|
}, "CV results dict key mismatch."
|
||||||
|
|
||||||
def test_cv_no_shuffle(self):
|
def test_cv_no_shuffle(self):
|
||||||
"""
|
"""
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user