docstr: Args:
      http_host: The host address for the Http server.
      http_port: The port for the Http server.
      http_port_retries: The maximum retry to bind ports for the Http server.
      gcs_address: The GCS address in the {address}:{port} format.
      log_dir: The log directory. E.g., /tmp/session_latest/logs.
      temp_dir: The temp directory. E.g., /tmp.
      session_dir: The session directory. E.g., tmp/session_latest.
      minimal: Whether or not it will load the minimal modules.
      serve_frontend: If configured, frontend HTML is
          served from the dashboard.
      grpc_port: The port used to listen for gRPC on.
      modules_to_load: A set of module name in string to load.
          By default (None), it loads all available modules.
          Note that available modules could be changed depending on
          minimal flags.
docstr_tok: ["Args",":","http_host",":","The","host","address","for","the","Http","server",".","http_port",":","The","port","for","the","Http","server",".","http_port_retries",":","The","maximum","retry","to","bind","ports","for","the","Http","server",".","gcs_address",":","The","GCS","address","in","the","{","address","}",":","{","port","}","format",".","log_dir",":","The","log","directory",".","E.g.",",","\/tmp\/session_latest\/logs",".","temp_dir",":","The","temp","directory",".","E.g.",",","\/tmp",".","session_dir",":","The","session","directory",".","E.g.",",","tmp\/session_latest",".","minimal",":","Whether","or","not","it","will","load","the","minimal","modules",".","serve_frontend",":","If","configured",",","frontend","HTML","is","served","from","the","dashboard",".","grpc_port",":","The","port","used","to","listen","for","gRPC","on",".","modules_to_load",":","A","set","of","module","name","in","string","to","load",".","By","default","(","None",")",",","it","loads","all","available","modules",".","Note","that","available","modules","could","be","changed","depending","on","minimal","flags","."]
code: def __init__(
      self,
      http_host: str,
      http_port: int,
      http_port_retries: int,
      gcs_address: str,
      node_ip_address: str,
      grpc_port: int,
      log_dir: str,
      temp_dir: str,
      session_dir: str,
      minimal: bool,
      serve_frontend: bool,
      modules_to_load: Optional[Set[str]] = None,
  ):
      """
      Args:
          http_host: The host address for the Http server.
          http_port: The port for the Http server.
          http_port_retries: The maximum retry to bind ports for the Http server.
          gcs_address: The GCS address in the {address}:{port} format.
          log_dir: The log directory. E.g., /tmp/session_latest/logs.
          temp_dir: The temp directory. E.g., /tmp.
          session_dir: The session directory. E.g., tmp/session_latest.
          minimal: Whether or not it will load the minimal modules.
          serve_frontend: If configured, frontend HTML is
              served from the dashboard.
          grpc_port: The port used to listen for gRPC on.
          modules_to_load: A set of module name in string to load.
              By default (None), it loads all available modules.
              Note that available modules could be changed depending on
              minimal flags.
      """
      self.minimal = minimal
      self.serve_frontend = serve_frontend
      # If it is the minimal mode, we shouldn't serve frontend.
      if self.minimal:
          self.serve_frontend = False
      self.health_check_thread: GCSHealthCheckThread = None
      self._gcs_rpc_error_counter = 0
      # Public attributes are accessible for all head modules.
      # Walkaround for issue: https://github.com/ray-project/ray/issues/7084
      self.http_host = (
          "127.0.0.1" if http_host == "localhost" else http_host
      )
      self.http_port = http_port
      self.http_port_retries = http_port_retries
      self._modules_to_load = modules_to_load
  
      self.gcs_address = None
      assert gcs_address is not None
      self.gcs_address = gcs_address
      self.log_dir = log_dir
      self.temp_dir = temp_dir
      self.session_dir = session_dir
      self.session_name = Path(session_dir).name
      self.aiogrpc_gcs_channel = None
      self.gcs_aio_client = None
      self.gcs_error_subscriber = None
      self.gcs_log_subscriber = None
      self.ip = node_ip_address
      DataOrganizer.head_node_ip = self.ip
  
      if self.minimal:
          self.server, self.grpc_port = None, None
      else:
          grpc_ip = "127.0.0.1" if self.ip == "127.0.0.1" else "0.0.0.0"
          self.server, self.grpc_port = initialize_grpc_port_and_server(
              grpc_ip, grpc_port
          )
          logger.info(
              "Dashboard head grpc address: %s:%s",
              grpc_ip,
              self.grpc_port,
          )
      # If the dashboard is started as non-minimal version, http server should
      # be configured to expose APIs.
      self.http_server = None
  
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 1 to create a new DashboardHead object  with example: obj = DashboardHead(http_host, http_port, http_port_retries, gcs_address, node_ip_address, grpc_port, log_dir, temp_dir, session_dir, minimal, serve_frontend, modules_to_load)