[python package] include dmlc-tracker into xgb python pkg (#4731)

This commit is contained in:
Xu Xiao
2019-08-06 00:21:07 +08:00
committed by Jiaming Yuan
parent b68de018b8
commit 97eece6ea0
6 changed files with 361 additions and 17 deletions

View File

@@ -0,0 +1,17 @@
import time
from xgboost import RabitTracker
import xgboost as xgb
def test_rabit_tracker():
tracker = RabitTracker(hostIP='127.0.0.1', nslave=1)
tracker.start(1)
rabit_env = [
str.encode('DMLC_TRACKER_URI=127.0.0.1'),
str.encode('DMLC_TRACKER_PORT=9091'),
str.encode('DMLC_TASK_ID=0')]
xgb.rabit.init(rabit_env)
ret = xgb.rabit.broadcast('test1234', 0)
assert str(ret) == 'test1234'
xgb.rabit.finalize()