class_docstr: Tracker module for PS
class_docstr_tok: ["Tracker","module","for","PS"]
docstr: Starts the PS scheduler
docstr_tok: ["Starts","the","PS","scheduler"]
code: def __init__(self, hostIP, cmd, port=9091, port_end=9999, envs=None):
      """
      Starts the PS scheduler
      """
      self.cmd = cmd
      if cmd is None:
          return
      envs = {} if envs is None else envs
      self.hostIP = hostIP
      sock = socket.socket(get_family(hostIP), socket.SOCK_STREAM)
      for port in range(port, port_end):
          try:
              sock.bind(("", port))
              self.port = port
              sock.close()
              break
          except socket.error:
              continue
      env = os.environ.copy()
  
      env["DMLC_ROLE"] = "scheduler"
      env["DMLC_PS_ROOT_URI"] = str(self.hostIP)
      env["DMLC_PS_ROOT_PORT"] = str(self.port)
      for k, v in envs.items():
          env[k] = str(v)
      self.thread = Thread(
          target=(
              lambda: subprocess.check_call(
                  self.cmd, env=env, shell=True, executable="/bin/bash"
              )
          ),
          args=(),
      )
      self.thread.setDaemon(True)
      self.thread.start()
  
imports: from __future__ import absolute_import
  import os
  import sys
  import socket
  import struct
  import subprocess
  import argparse
  import time
  import logging
  from threading import Thread
label_desc: Use image node_id 1 to create a new PSTracker object from inherited base classes: object with example: obj = PSTracker(hostIP, cmd, port, port_end, envs)