class_docstr: tracker for rabit
docstr: A Python implementation of RABIT tracker.
  
  Parameters
  ..........
  use_logger:
      Use logging.info for tracker print command.  When set to False, Python print
      function is used instead.
  
  sortby:
      How to sort the workers for rank assignment. The default is host, but users
      can set the `DMLC_TASK_ID` via RABIT initialization arguments and obtain
      deterministic rank assignment. Available options are:
        - host
        - task
code: def __init__(
      self,
      host_ip: str,
      n_workers: int,
      port: int = 0,
      use_logger: bool = False,
      sortby: str = "host",
  ) -> None:
      """A Python implementation of RABIT tracker.
  
      Parameters
      ..........
      use_logger:
          Use logging.info for tracker print command.  When set to False, Python print
          function is used instead.
  
      sortby:
          How to sort the workers for rank assignment. The default is host, but users
          can set the `DMLC_TASK_ID` via RABIT initialization arguments and obtain
          deterministic rank assignment. Available options are:
            - host
            - task
  
      """
      sock = socket.socket(get_family(host_ip), socket.SOCK_STREAM)
      sock.bind((host_ip, port))
      self.port = sock.getsockname()[1]
      sock.listen(256)
      self.sock = sock
      self.host_ip = host_ip
      self.thread: Optional[Thread] = None
      self.n_workers = n_workers
      self._use_logger = use_logger
      self._sortby = sortby
      logging.info("start listen on %s:%d", host_ip, self.port)
  
imports: import argparse
  import logging
  import socket
  import struct
  import sys
  from threading import Thread
  from typing import Dict, List, Optional, Set, Tuple, Union
label_desc: Use image node_id 1 to create a new RabitTracker object  with example: obj = RabitTracker(host_ip, n_workers, port, use_logger, sortby)