class_docstr: Convenient class for launching a Dask cluster in a `RuntimeGroup`.
  
  DaskCluster inherits from MasterWorkerCluster. See its documentation to get a list of the inherited methods
  and attributes.
  
  The number of DASK 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 DASK 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
  DASK master (i.e. scheduler) 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`.
class_docstr_tok: ["Convenient","class","for","launching","a","Dask","cluster","in","a","`","RuntimeGroup","`",".","DaskCluster","inherits","from","MasterWorkerCluster",".","See","its","documentation","to","get","a","list","of","the","inherited","methods","and","attributes",".","The","number","of","DASK","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","DASK","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","DASK","master","(","i.e",".","scheduler",")","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: Get a connected Dask client.
  
  Args:
      timeout: The timeout (s) value passed on to the Dask `Client` constructor. Defaults to 2.
  
  Raises:
      TimeoutError: If client connection `timeout` expires.
docstr_tok: ["Get","a","connected","Dask","client",".","Args",":","timeout",":","The","timeout","(","s",")","value","passed","on","to","the","Dask","`","Client","`","constructor",".","Defaults","to","2",".","Raises",":","TimeoutError",":","If","client","connection","`","timeout","`","expires","."]
code: def get_client(self, timeout: int = 2) -> Client:
      """Get a connected Dask client.
  
      Args:
          timeout: The timeout (s) value passed on to the Dask `Client` constructor. Defaults to 2.
  
      Raises:
          TimeoutError: If client connection `timeout` expires.
      """
      return Client(
          "localhost:" + str(self.master_port), timeout=timeout
      )
  
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 DaskCluster obj's underlying member method code with example usage: obj.get_client(timeout) and returns: Client