class_docstr: The worker is responsible for evaluating a single configuration on a single budget at a time.
  Communication to the individual workers goes via the nameserver, management of the worker-pool and job
  scheduling is done by the Dispatcher and jobs are determined by the Master. In distributed systems, each
  cluster-node runs a Worker-instance. To implement your own worker, overwrite the `__init__`- and the `compute`-method.
  The first allows to perform inital computations, e.g. loading the dataset, when the worker is started, while the
  latter is repeatedly called during the optimization and evaluates a given configuration yielding the associated loss.
class_docstr_tok: ["The","worker","is","responsible","for","evaluating","a","single","configuration","on","a","single","budget","at","a","time",".","Communication","to","the","individual","workers","goes","via","the","nameserver",",","management","of","the","worker-pool","and","job","scheduling","is","done","by","the","Dispatcher","and","jobs","are","determined","by","the","Master",".","In","distributed","systems",",","each","cluster-node","runs","a","Worker-instance",".","To","implement","your","own","worker",",","overwrite","the","`","__init__","`","-","and","the","`","compute","`","-method",".","The","first","allows","to","perform","inital","computations",",","e.g",".","loading","the","dataset",",","when","the","worker","is","started",",","while","the","latter","is","repeatedly","called","during","the","optimization","and","evaluates","a","given","configuration","yielding","the","associated","loss","."]
code: def _run(self):
      # initial ping to the dispatcher to register the worker
  
      try:
          with Pyro4.locateNS(
              host=self.nameserver, port=self.nameserver_port
          ) as ns:
              self.logger.debug(
                  "WORKER: Connected to nameserver %s" % (str(ns))
              )
              dispatchers = ns.list(
                  prefix="hpbandster.run_%s.dispatcher" % self.run_id
              )
      except Pyro4.errors.NamingError:
          if self.thread is None:
              raise RuntimeError(
                  "No nameserver found. Make sure the nameserver is running at that the host (%s) and port (%s) are correct"
                  % (self.nameserver, self.nameserver_port)
              )
          else:
              self.logger.error(
                  "No nameserver found. Make sure the nameserver is running at that the host (%s) and port (%s) are correct"
                  % (self.nameserver, self.nameserver_port)
              )
              exit(1)
      except:
          raise
  
      for dn, uri in dispatchers.items():
          try:
              self.logger.debug("WORKER: found dispatcher %s" % dn)
              with Pyro4.Proxy(uri) as dispatcher_proxy:
                  dispatcher_proxy.trigger_discover_worker()
  
          except Pyro4.errors.CommunicationError:
              self.logger.debug(
                  "WORKER: Dispatcher did not respond. Waiting for one to initiate contact."
              )
              pass
          except:
              raise
  
      if len(dispatchers) == 0:
          self.logger.debug(
              "WORKER: No dispatcher found. Waiting for one to initiate contact."
          )
  
      self.logger.info("WORKER: start listening for jobs")
  
      self.pyro_daemon = Pyro4.core.Daemon(host=self.host)
  
      with Pyro4.locateNS(
          self.nameserver, port=self.nameserver_port
      ) as ns:
          uri = self.pyro_daemon.register(self, self.worker_id)
          ns.register(self.worker_id, uri)
  
      self.pyro_daemon.requestLoop()
  
      with Pyro4.locateNS(
          self.nameserver, port=self.nameserver_port
      ) as ns:
          ns.remove(self.worker_id)
  
file_path: HpBandSter/hpbandster/core/worker.py
imports: import time
  import logging
  import pickle
  import os, socket
  import traceback
  import threading
  import Pyro4
label_desc: Use image node_id 4 for calling the Worker obj's underlying member method code with example usage: obj._run() without return types