class_docstr: The dispatcher is responsible for assigning tasks to free workers, report results back to the master and
  communicate to the nameserver.
class_docstr_tok: ["The","dispatcher","is","responsible","for","assigning","tasks","to","free","workers",",","report","results","back","to","the","master","and","communicate","to","the","nameserver","."]
docstr: Parameters
  ----------
  new_result_callback: function
      function that will be called with a `Job instance <hpbandster.core.dispatcher.Job>`_ as argument.
      From the `Job` the result can be read and e.g. logged.
  run_id: str
      unique run_id associated with the HPB run
  ping_interval: int
      how often to ping for workers (in seconds)
  nameserver: str
      address of the Pyro4 nameserver
  nameserver_port: int
      port of Pyro4 nameserver
  host: str
      ip (or name that resolves to that) of the network interface to use
  logger: logging.Logger
      logger-instance for info and debug
  queue_callback: function
      gets called with the number of workers in the pool on every update-cycle
docstr_tok: ["Parameters","--","--","--","--","--","new_result_callback",":","function","function","that","will","be","called","with","a","`","Job","instance","<","hpbandster.core.dispatcher.Job",">","`","_","as","argument",".","From","the","`","Job","`","the","result","can","be","read","and","e.g",".","logged",".","run_id",":","str","unique","run_id","associated","with","the","HPB","run","ping_interval",":","int","how","often","to","ping","for","workers","(","in","seconds",")","nameserver",":","str","address","of","the","Pyro4","nameserver","nameserver_port",":","int","port","of","Pyro4","nameserver","host",":","str","ip","(","or","name","that","resolves","to","that",")","of","the","network","interface","to","use","logger",":","logging.Logger","logger-instance","for","info","and","debug","queue_callback",":","function","gets","called","with","the","number","of","workers","in","the","pool","on","every","update-cycle"]
code: def __init__(
      self,
      new_result_callback,
      run_id="0",
      ping_interval=10,
      nameserver="localhost",
      nameserver_port=None,
      host=None,
      logger=None,
      queue_callback=None,
  ):
      """
      Parameters
      ----------
      new_result_callback: function
          function that will be called with a `Job instance <hpbandster.core.dispatcher.Job>`_ as argument.
          From the `Job` the result can be read and e.g. logged.
      run_id: str
          unique run_id associated with the HPB run
      ping_interval: int
          how often to ping for workers (in seconds)
      nameserver: str
          address of the Pyro4 nameserver
      nameserver_port: int
          port of Pyro4 nameserver
      host: str
          ip (or name that resolves to that) of the network interface to use
      logger: logging.Logger
          logger-instance for info and debug
      queue_callback: function
          gets called with the number of workers in the pool on every update-cycle
      """
  
      self.new_result_callback = new_result_callback
      self.queue_callback = queue_callback
      self.run_id = run_id
      self.nameserver = nameserver
      self.nameserver_port = nameserver_port
      self.host = host
      self.ping_interval = int(ping_interval)
      self.shutdown_all_threads = False
  
      if logger is None:
          self.logger = logging.getLogger("hpbandster")
      else:
          self.logger = logger
  
      self.worker_pool = {}
  
      self.waiting_jobs = queue.Queue()
      self.running_jobs = {}
      self.idle_workers = set()
  
      self.thread_lock = threading.Lock()
      self.runner_cond = threading.Condition(self.thread_lock)
      self.discover_cond = threading.Condition(self.thread_lock)
  
      self.pyro_id = "hpbandster.run_%s.dispatcher" % self.run_id
  
imports: import threading
  import logging
  import queue
  import time
  import Pyro4
label_desc: Use image node_id 1 to create a new Dispatcher object from inherited base classes: object with example: obj = Dispatcher(new_result_callback, run_id, ping_interval, nameserver, nameserver_port, host, logger, queue_callback)