class_docstr: Convenient class for launching a Hyperopt cluster in a `RuntimeGroup`.
  
  HyperoptCluster inherits from MasterWorkerCluster. See its documentation to get a list of the inherited methods
  and attributes.
  
  The number of hyperopt workers defaults to the number of `Runtimes` in the used `RuntimeGroup`. This number can be
  adjusted so that more or less workers than available `Runtimes` can be used. Per default the desired number of
  workers is started in a round robin way as implemented in `RoundRobinLauncher`. Consequently, this leads to an
  equal distribution of hyperopt workers in the `RuntimeGroup`. You can provide a custom implementation inheriting
  from the `WorkerLauncher` class in order to execute a different strategy how workers should be started. The
  master instance (i.e. the mongoDB) will always be started on localhost as implemented in `LocalMasterLauncher`. This
  behavior can also be changed by providing a custom implementation inheriting from the `MasterLauncher`.
docstr: Initialization method.
  
  Args:
      runtime_group: The `RuntimeGroup` contains all `Runtimes` which can be used for starting the entities.
      mongo_launcher: Optionally, an instance implementing the `MasterLauncher` interface can be given, which
                      implements the strategy for launching the master instances in the cluster. If None, then
                      `LocalMasterLauncher` is used.
      worker_launcher: Optionally, an instance implementing the `WorkerLauncher` interface can be given, which
                       implements the strategy for launching the worker instances. If None, then
                       `RoundRobinLauncher` is used.
      dbpath: The directory where the db files will be kept. Defaults to a `mongodb` directory inside the
              `utils.Environment.main_directory`.
      dbname: The name of the database to be used for experiments. See MongoTrials url scheme in hyperopt
              documentation for more details. Defaults to ´hyperopt´.
      worker_poll_intervall: The poll interval of the hyperopt worker. Defaults to `0.1`.
  
  Raises:
      PermissionError: If the `dbpath` does not exsist and could not be created due to lack of permissions.
docstr_tok: ["Initialization","method",".","Args",":","runtime_group",":","The","`","RuntimeGroup","`","contains","all","`","Runtimes","`","which","can","be","used","for","starting","the","entities",".","mongo_launcher",":","Optionally",",","an","instance","implementing","the","`","MasterLauncher","`","interface","can","be","given",",","which","implements","the","strategy","for","launching","the","master","instances","in","the","cluster",".","If","None",",","then","`","LocalMasterLauncher","`","is","used",".","worker_launcher",":","Optionally",",","an","instance","implementing","the","`","WorkerLauncher","`","interface","can","be","given",",","which","implements","the","strategy","for","launching","the","worker","instances",".","If","None",",","then","`","RoundRobinLauncher","`","is","used",".","dbpath",":","The","directory","where","the","db","files","will","be","kept",".","Defaults","to","a","`","mongodb","`","directory","inside","the","`","utils.Environment.main_directory","`",".","dbname",":","The","name","of","the","database","to","be","used","for","experiments",".","See","MongoTrials","url","scheme","in","hyperopt","documentation","for","more","details",".","Defaults","to","\u00b4hyperopt\u00b4",".","worker_poll_intervall",":","The","poll","interval","of","the","hyperopt","worker",".","Defaults","to","`","0.1","`",".","Raises",":","PermissionError",":","If","the","`","dbpath","`","does","not","exsist","and","could","not","be","created","due","to","lack","of","permissions","."]
code: def __init__(
      self,
      runtime_group: RuntimeGroup,
      mongo_launcher: Optional[MongoLauncher] = None,
      worker_launcher: Optional[WorkerLauncher] = None,
      dbpath: Optional[str] = None,
      dbname: str = "hyperopt",
      worker_poll_intervall: float = 0.1,
  ):
      """Initialization method.
  
      Args:
          runtime_group: The `RuntimeGroup` contains all `Runtimes` which can be used for starting the entities.
          mongo_launcher: Optionally, an instance implementing the `MasterLauncher` interface can be given, which
                          implements the strategy for launching the master instances in the cluster. If None, then
                          `LocalMasterLauncher` is used.
          worker_launcher: Optionally, an instance implementing the `WorkerLauncher` interface can be given, which
                           implements the strategy for launching the worker instances. If None, then
                           `RoundRobinLauncher` is used.
          dbpath: The directory where the db files will be kept. Defaults to a `mongodb` directory inside the
                  `utils.Environment.main_directory`.
          dbname: The name of the database to be used for experiments. See MongoTrials url scheme in hyperopt
                  documentation for more details. Defaults to ´hyperopt´.
          worker_poll_intervall: The poll interval of the hyperopt worker. Defaults to `0.1`.
  
      Raises:
          PermissionError: If the `dbpath` does not exsist and could not be created due to lack of permissions.
      """
      super().__init__(runtime_group)
  
      self._master_launcher = mongo_launcher or LocalMongoLauncher(
          runtime_group
      )
  
      if dbpath:
          self._master_launcher.dbpath = os.path.join(
              Environment.main_directory, "mongodb"
          )
          assert self._master_launcher.dbpath
          try:
              os.makedirs(
                  self._master_launcher.dbpath
              )  # Raises PermissionError
          except FileExistsError:
              # All good because the dir already exists
              pass
      else:
          self._master_launcher.dbpath = dbpath
  
      self._dbname = dbname
  
      self._worker_launcher = (
          worker_launcher
          if worker_launcher
          else RoundRobinLauncher(
              runtime_group, dbname, worker_poll_intervall
          )
      )
  
      self.log.debug("HyperoptCluster initialized.")
  
imports: import os
  import time
  from typing import List, Optional, Union
  from lazycluster import Runtime, RuntimeGroup, RuntimeTask, _utils
  from lazycluster.cluster import MasterLauncher, MasterWorkerCluster, WorkerLauncher
  from lazycluster.cluster.exceptions import MasterStartError
  from lazycluster.exceptions import PortInUseError
  from lazycluster.utils import Environment
label_desc: Use image node_id 1 to create a new HyperoptCluster object from inherited base classes: MasterWorkerCluster with example: obj = HyperoptCluster(runtime_group, mongo_launcher, worker_launcher, dbpath, dbname, worker_poll_intervall)