Skip to content

Commit

Permalink
Add typehint to tracker. (#7338)
Browse files Browse the repository at this point in the history
  • Loading branch information
trivialfis committed Oct 20, 2021
1 parent 5ff210e commit f53da41
Show file tree
Hide file tree
Showing 4 changed files with 122 additions and 94 deletions.
7 changes: 5 additions & 2 deletions Makefile
Expand Up @@ -93,11 +93,14 @@ mypy:
cd python-package; \
mypy ./xgboost/dask.py && \
mypy ./xgboost/rabit.py && \
mypy ./xgboost/tracker.py && \
mypy ./xgboost/sklearn.py && \
mypy ../demo/guide-python/external_memory.py && \
mypy ../demo/guide-python/categorical.py && \
mypy ../demo/guide-python/cat_in_the_dat.py && \
mypy ../tests/python-gpu/test_gpu_with_dask.py && \
mypy ../tests/python/test_data_iterator.py && \
mypy ../tests/python-gpu/test_gpu_data_iterator.py && \
mypy ./xgboost/sklearn.py || exit 1; \
mypy ../tests/python-gpu/test_gpu_data_iterator.py || exit 1; \
mypy . || true ;

clean:
Expand Down
6 changes: 3 additions & 3 deletions python-package/xgboost/dask.py
Expand Up @@ -138,10 +138,10 @@ async def __aexit__(self, *args: Any, **kwargs: Any) -> None:

def _start_tracker(n_workers: int) -> Dict[str, Any]:
"""Start Rabit tracker """
env = {'DMLC_NUM_WORKER': n_workers}
env: Dict[str, Union[int, str]] = {'DMLC_NUM_WORKER': n_workers}
host = get_host_ip('auto')
rabit_context = RabitTracker(hostIP=host, nslave=n_workers, use_logger=False)
env.update(rabit_context.slave_envs())
rabit_context = RabitTracker(hostIP=host, n_workers=n_workers, use_logger=False)
env.update(rabit_context.worker_envs())

rabit_context.start(n_workers)
thread = Thread(target=rabit_context.join)
Expand Down

0 comments on commit f53da41

Please sign in to comment.