code: def test_parallel_runs(
      make_dummy_ta: Callable[..., TargetFunctionRunner]
  ) -> None:
      """Make sure because there are 2 workers, the trials are launched close in time"""
      single_runner = make_dummy_ta(target_delayed, n_workers=2)
      runner = DaskParallelRunner(single_worker=single_runner)
  
      assert runner.count_available_workers() == 2
  
      trial_info = TrialInfo(
          config=2, instance="test", seed=0, budget=0.0
      )
      runner.submit_trial(trial_info)
  
      assert runner.count_available_workers() == 1
  
      trial_info = TrialInfo(
          config=3, instance="test", seed=0, budget=0.0
      )
      runner.submit_trial(trial_info)
  
      assert runner.count_available_workers() == 0
  
      # At this stage, we submitted 2 jobs, that are running in remote workers.
      # We have to wait for each one of them to complete. The runner provides a
      # wait() method to do so, yet it can only wait for a single job to be completed.
      # It does internally via dask wait(<list of futures>) so we take wait for the
      # first job to complete, and take it out
      runner.wait()
      first = next(runner.iter_results(), None)
  
      # The iter results could have freed up two so we only check it's one or greater
      assert first is not None
      assert runner.count_available_workers() >= 1
  
      # Again, the runs might take slightly different time depending if we have
      # heterogeneous workers, so calling wait 2 times is a guarantee that 2
      # jobs are finished
      runner.wait()
      second = next(runner.iter_results(), None)
  
      assert second is not None
      assert runner.count_available_workers() == 2
  
      # To make it is parallel, we just make sure that the start of the second run is
      # earlier than the end of the first run
      _, first_run_value = first
      _, second_run_value = second
  
      assert int(first_run_value.starttime) <= int(
          second_run_value.endtime
      )
  
file_path: SMAC3/tests/test_runner/test_dask_runner.py
imports: from __future__ import annotations
  from typing import Callable
  import time
  import pytest
  from ConfigSpace import ConfigurationSpace
  from dask.distributed import Client
  from smac.runhistory import TrialInfo, TrialValue
  from smac.runner.abstract_runner import StatusType
  from smac.runner.dask_runner import DaskParallelRunner
  from smac.runner.target_function_runner import TargetFunctionRunner
  from smac.scenario import Scenario
label_desc: Use image node_id 6 for calling a global function with example usage: test_parallel_runs(make_dummy_ta) without return types