class_docstr: WorkerLauncher implementation for launching DASK workers in a round robin manner. See its documentation to get a list of the inherited methods and attributes.
class_docstr_tok: ["WorkerLauncher","implementation","for","launching","DASK","workers","in","a","round","robin","manner",".","See","its","documentation","to","get","a","list","of","the","inherited","methods","and","attributes","."]
docstr: Launches the worker instances in the `RuntimeGroup`.
  
  Args:
      worker_count: The number of worker instances to be started in the group.
      master_port:  The port of the master instance.
      ports: The ports to be used for starting the workers. Only ports from the list will be chosen
                         that are actually free.
      debug: If `True`, stdout/stderr from the runtime will be printed to stdout of localhost. If, `False` then
             the stdout/stderr will be added to python logger with level debug after each `RuntimeTask` step. Defaults to
             `False`.
  
  Returns:
      List[int]: The updated port list after starting the workers, i.e. the used ones were removed.
  
  Raises:
      NoPortsLeftError: If there are not enough free ports for starting all workers.
docstr_tok: ["Launches","the","worker","instances","in","the","`","RuntimeGroup","`",".","Args",":","worker_count",":","The","number","of","worker","instances","to","be","started","in","the","group",".","master_port",":","The","port","of","the","master","instance",".","ports",":","The","ports","to","be","used","for","starting","the","workers",".","Only","ports","from","the","list","will","be","chosen","that","are","actually","free",".","debug",":","If","`","True","`",",","stdout\/stderr","from","the","runtime","will","be","printed","to","stdout","of","localhost",".","If",",","`","False","`","then","the","stdout\/stderr","will","be","added","to","python","logger","with","level","debug","after","each","`","RuntimeTask","`","step",".","Defaults","to","`","False","`",".","Returns",":","List","[","int","]",":","The","updated","port","list","after","starting","the","workers",",","i.e",".","the","used","ones","were","removed",".","Raises",":","NoPortsLeftError",":","If","there","are","not","enough","free","ports","for","starting","all","workers","."]
code: def start(
      self,
      worker_count: int,
      master_port: int,
      ports: List[int],
      debug: bool = False,
  ) -> List[int]:
      """Launches the worker instances in the `RuntimeGroup`.
  
      Args:
          worker_count: The number of worker instances to be started in the group.
          master_port:  The port of the master instance.
          ports: The ports to be used for starting the workers. Only ports from the list will be chosen
                             that are actually free.
          debug: If `True`, stdout/stderr from the runtime will be printed to stdout of localhost. If, `False` then
                 the stdout/stderr will be added to python logger with level debug after each `RuntimeTask` step. Defaults to
                 `False`.
  
      Returns:
          List[int]: The updated port list after starting the workers, i.e. the used ones were removed.
  
      Raises:
          NoPortsLeftError: If there are not enough free ports for starting all workers.
      """
      self._ports = ports.copy()
      hosts = self._group.hosts
      runtimes = self._group.runtimes
  
      # Launch each desired worker one by one
      for worker_index in range(worker_count):
          # Determine the runtime where the next worker will be started in
          runtime_index = (
              self._group.runtime_count + worker_index
          ) % self._group.runtime_count
          # Get the actual host corresponding to the index
          host = hosts[runtime_index]
          working_dir = runtimes[runtime_index].working_dir
          assert host == runtimes[runtime_index].host
  
          self.log.debug(
              f"Launch Dask worker with index {worker_index} on Runtime {host}"
          )
  
          worker_port = self._launch_single_worker(
              host, worker_index, master_port, working_dir, debug
          )  # NoPortsLeftError
          # Remember which worker ports are now used per `Runtime`
          if host in self._ports_per_host:
              self._ports_per_host[host].append(worker_port)
          else:
              self._ports_per_host.update({host: [worker_port]})
  
      # Needed for worker communication between workers, which is necessary in case of DASK
      self.setup_worker_ssh_tunnels()
  
      return self._ports
  
imports: import time
  from subprocess import Popen
  from typing import List, Optional, Union
  from distributed import Client
  from lazycluster import Runtime, RuntimeGroup, RuntimeTask, _utils
  from lazycluster.cluster import MasterLauncher, MasterWorkerCluster, WorkerLauncher
  from lazycluster.cluster.exceptions import MasterStartError
  from lazycluster.exceptions import NoPortsLeftError, PortInUseError
label_desc: Use image node_id 2 for calling the RoundRobinLauncher obj's underlying member method code with example usage: obj.start(worker_count, master_port, ports, debug) and returns: self