code: def get_worker_manager_from_type(
      num_workers=1,
      worker_manager_type="default",
      capital_type=None,
      tmp_dir=None,
      *args,
      **kwargs,
  ):
      """Get worker manager."""
      # If worker_manager_type is already a WorkerManager instance, --------------------------
      # then simply return this.
      if isinstance(worker_manager_type, AbstractWorkerManager):
          return worker_manager_type
      # Assign worker manager type depending on the capital_type -----------------------------
      # if worker_manager_type is default
      if worker_manager_type == "default":
          if capital_type in ["return_value", "num_evals"]:
              _wm_type = "synthetic"
          elif capital_type == "realtime":
              _wm_type = "multiprocessing"
          else:
              raise ValueError(
                  (
                      "If worker_manager_type is default, capital_type should be one "
                      + "return_value, num_evals, or multiprocessing. Given : %s."
                  )
                  % (capital_type)
              )
      else:
          _wm_type = worker_manager_type
      # Now create the worker manager --------------------------------------------------------
      if _wm_type == "synthetic":
          return SyntheticWorkerManager(
              num_workers=num_workers, *args, **kwargs
          )
      elif _wm_type == "multiprocessing":
          if tmp_dir is None:
              from datetime import datetime
  
              tmp_dir = "./tmp_%s" % (
                  datetime.now().strftime("%m%d_%H%M%S")
              )
          return MultiProcessingWorkerManager(
              worker_ids=num_workers, tmp_dir=tmp_dir
          )
      elif _wm_type == "scheduling":
          raise NotImplementedError(
              "Not Implemented a SchedulingWorkerManager yet!"
          )
      else:
          raise ValueError(
              "Unknown worker_manager_type: %s." % (_wm_type)
          )
  
file_path: dragonfly/dragonfly/apis/api_utils.py
imports: from argparse import Namespace
  import numpy
  from ..exd.cp_domain_utils import load_config_file, get_processed_func_from_raw_func_for_cp_domain_fidelity, get_processed_func_from_raw_func_for_cp_domain
  from ..exd.domains import EuclideanDomain
  from ..exd.worker_manager import MultiProcessingWorkerManager, SyntheticWorkerManager, AbstractWorkerManager
  from ..opt.ga_optimiser import ga_opt_args
  from ..opt.gp_bandit import get_all_euc_gp_bandit_args, get_all_cp_gp_bandit_args, get_all_mf_euc_gp_bandit_args, get_all_mf_cp_gp_bandit_args
  from ..opt.random_optimiser import euclidean_random_optimiser_args, mf_euclidean_random_optimiser_args, cp_random_optimiser_args, mf_cp_random_optimiser_args
  from ..opt.multiobjective_gp_bandit import get_all_euc_moo_gp_bandit_args, get_all_cp_moo_gp_bandit_args
  from ..opt.random_multiobjective_optimiser import euclidean_random_multiobjective_optimiser_args, cp_random_multiobjective_optimiser_args
  from ..utils.general_utils import map_to_bounds
  from ..utils.option_handler import load_options
label_desc: Use image node_id 1 for calling a global function with example usage: get_worker_manager_from_type(num_workers, worker_manager_type, capital_type, tmp_dir) and returns: worker_manager_type, SyntheticWorkerManager, MultiProcessingWorkerManager