docstr: Load dashboard head modules.
  
  Args:
      modules: A list of module names to load. By default (None),
          it loads all modules.
docstr_tok: ["Load","dashboard","head","modules",".","Args",":","modules",":","A","list","of","module","names","to","load",".","By","default","(","None",")",",","it","loads","all","modules","."]
code: def _load_modules(self, modules_to_load: Optional[Set[str]] = None):
      """Load dashboard head modules.
  
      Args:
          modules: A list of module names to load. By default (None),
              it loads all modules.
      """
      modules = []
      head_cls_list = dashboard_utils.get_all_modules(
          DashboardHeadModule
      )
  
      # Select modules to load.
      modules_to_load = modules_to_load or {
          m.__name__ for m in head_cls_list
      }
      logger.info("Modules to load: %s", modules_to_load)
  
      for cls in head_cls_list:
          logger.info(
              "Loading %s: %s", DashboardHeadModule.__name__, cls
          )
          if cls.__name__ in modules_to_load:
              c = cls(self)
              modules.append(c)
  
      # Verify modules are loaded as expected.
      loaded_modules = {type(m).__name__ for m in modules}
      if loaded_modules != modules_to_load:
          assert False, (
              "Actual loaded modules, {}, doesn't match the requested modules "
              "to load, {}".format(loaded_modules, modules_to_load)
          )
  
      logger.info("Loaded %d modules. %s", len(modules), modules)
      return modules
  
imports: import asyncio
  import logging
  import os
  from pathlib import Path
  import threading
  from concurrent.futures import Future
  from queue import Queue
  import ray.dashboard.consts
  import ray.dashboard.utils
  import ray.experimental.internal_kv
  from ray._private.usage.usage_lib import TagKey, record_extra_usage_tag
  from ray._private import ray_constants
  from ray.dashboard.utils import DashboardHeadModule
  from ray._raylet import GcsClient, check_health
  from ray.dashboard.datacenter import DataOrganizer
  from ray.dashboard.utils import async_loop_forever
  from ray.dashboard.consts import DASHBOARD_METRIC_PORT
  from ray.dashboard.dashboard_metrics import DashboardPrometheusMetrics
  from typing import Optional, Set
label_desc: Use image node_id 3 for calling the DashboardHead obj's underlying member method code with example usage: obj._load_modules(modules_to_load) and returns: modules