code: def compose_and_dump(
      output_file: "StrPath",
      config_dir: Optional[str],
      config_module: Optional[str],
      config_name: str,
      overrides: List[str],
  ) -> None:
      """Compose Hydra config and dumpt it to `output_file`.
  
      Args:
          output_file: File where the composed config will be dumped.
          config_dir: Folder containing the Hydra config files.
              Must be absolute file system path.
          config_module: Module containing the Hydra config files.
              Ignored if `config_dir` is not `None`.
          config_name: Name of the config file containing defaults,
              without the .yaml extension.
          overrides: List of `Hydra Override`_ patterns.
  
      .. _Hydra Override:
          https://hydra.cc/docs/advanced/override_grammar/basic/
      """
      from hydra import (
          compose,
          initialize_config_dir,
          initialize_config_module,
      )
      from omegaconf import OmegaConf
  
      from .serialize import DUMPERS
  
      config_source = config_dir or config_module
      if not config_source:
          raise ValueError(
              "Either `config_dir` or `config_module` should be provided."
          )
      initialize_config = (
          initialize_config_dir
          if config_dir
          else initialize_config_module
      )
  
      with initialize_config(  # type: ignore[attr-defined]
          config_source, version_base=None
      ):
          cfg = compose(config_name=config_name, overrides=overrides)
  
      OmegaConf.resolve(cfg)
  
      suffix = Path(output_file).suffix.lower()
      if suffix not in [".yml", ".yaml"]:
          dumper = DUMPERS[suffix]
          dumper(output_file, OmegaConf.to_object(cfg))
      else:
          Path(output_file).write_text(
              OmegaConf.to_yaml(cfg), encoding="utf-8"
          )
      logger.trace(
          "Hydra composition enabled. Contents dumped to %s:\n %s",
          output_file,
          cfg,
      )
  
file_path: dvc/dvc/utils/hydra.py
imports: from pathlib import Path
  from typing import TYPE_CHECKING, List, Optional
  from dvc.exceptions import InvalidArgumentError
  from dvc.log import logger
  from .collections import merge_dicts, remove_missing_keys, to_omegaconf
label_desc: Use image node_id 1 for calling a global function with example usage: compose_and_dump(output_file, config_dir, config_module, config_name, overrides) without return types