class_docstr: Helper class providing methods for saving changes made to an experiment
  if `db_settings` property is set to a non-None value on the instance.
class_docstr_tok: ["Helper","class","providing","methods","for","saving","changes","made","to","an","experiment","if","`","db_settings","`","property","is","set","to","a","non-None","value","on","the","instance","."]
docstr: Loads experiment and its corresponding generation strategy from database
  if DB settings are set on this `WithDBSettingsBase` instance.
  
  Args:
      experiment_name: Name of the experiment to load, used as unique
          identifier by which to find the experiment.
      reduced_state: Whether to load experiment and generation strategy
          with a slightly reduced state (without abandoned arms on experiment
          and model state on each generator run in experiment and generation
          strategy; last generator run on generation strategy will still
          have its model state).
  
  Returns:
      - Tuple of `None` and `None` if `DBSettings` are set and no experiment
        exists by the given name.
      - Tuple of `Experiment` and `None` if experiment exists but does not
        have a generation strategy attached to it.
      - Tuple of `Experiment` and `GenerationStrategy` if experiment exists
        and has a generation strategy attached to it.
docstr_tok: ["Loads","experiment","and","its","corresponding","generation","strategy","from","database","if","DB","settings","are","set","on","this","`","WithDBSettingsBase","`","instance",".","Args",":","experiment_name",":","Name","of","the","experiment","to","load",",","used","as","unique","identifier","by","which","to","find","the","experiment",".","reduced_state",":","Whether","to","load","experiment","and","generation","strategy","with","a","slightly","reduced","state","(","without","abandoned","arms","on","experiment","and","model","state","on","each","generator","run","in","experiment","and","generation","strategy",";","last","generator","run","on","generation","strategy","will","still","have","its","model","state",")",".","Returns",":","-","Tuple","of","`","None","`","and","`","None","`","if","`","DBSettings","`","are","set","and","no","experiment","exists","by","the","given","name",".","-","Tuple","of","`","Experiment","`","and","`","None","`","if","experiment","exists","but","does","not","have","a","generation","strategy","attached","to","it",".","-","Tuple","of","`","Experiment","`","and","`","GenerationStrategy","`","if","experiment","exists","and","has","a","generation","strategy","attached","to","it","."]
code: def _load_experiment_and_generation_strategy(
      self,
      experiment_name: str,
      reduced_state: bool = False,
      skip_runners_and_metrics: bool = False,
  ) -> Tuple[Optional[Experiment], Optional[GenerationStrategy]]:
      """Loads experiment and its corresponding generation strategy from database
      if DB settings are set on this `WithDBSettingsBase` instance.
  
      Args:
          experiment_name: Name of the experiment to load, used as unique
              identifier by which to find the experiment.
          reduced_state: Whether to load experiment and generation strategy
              with a slightly reduced state (without abandoned arms on experiment
              and model state on each generator run in experiment and generation
              strategy; last generator run on generation strategy will still
              have its model state).
  
      Returns:
          - Tuple of `None` and `None` if `DBSettings` are set and no experiment
            exists by the given name.
          - Tuple of `Experiment` and `None` if experiment exists but does not
            have a generation strategy attached to it.
          - Tuple of `Experiment` and `GenerationStrategy` if experiment exists
            and has a generation strategy attached to it.
      """
      if not self.db_settings_set:
          raise ValueError(
              "Cannot load from DB in absence of DB settings."
          )
  
      logger.info(
          "Loading experiment and generation strategy (with reduced state: "
          f"{reduced_state})..."
      )
      start_time = time.time()
      experiment = _load_experiment(
          experiment_name,
          decoder=self.db_settings.decoder,
          reduced_state=reduced_state,
          load_trials_in_batches_of_size=LOADING_MINI_BATCH_SIZE,
          ax_object_field_overrides=self.AX_OBJECT_FIELD_OVERRIDES,
          skip_runners_and_metrics=skip_runners_and_metrics,
      )
      if not isinstance(experiment, Experiment):
          raise ValueError("Service API only supports `Experiment`.")
      logger.info(
          f"Loaded experiment {experiment_name} in "
          f"{_round_floats_for_logging(time.time() - start_time)} seconds, "
          f"loading trials in mini-batches of {LOADING_MINI_BATCH_SIZE}."
      )
  
      try:
          start_time = time.time()
          generation_strategy = (
              _load_generation_strategy_by_experiment_name(
                  experiment_name=experiment_name,
                  decoder=self.db_settings.decoder,
                  experiment=experiment,
                  reduced_state=reduced_state,
              )
          )
          logger.info(
              f"Loaded generation strategy for experiment {experiment_name} in "
              f"{_round_floats_for_logging(time.time() - start_time)} seconds."
          )
      except ObjectNotFoundError:
          logger.info(
              "There is no generation strategy associated with experiment "
              f"{experiment_name}."
          )
  
          return experiment, None
  
      return experiment, generation_strategy
  
imports: import re
  import time
  from logging import INFO, Logger
  from typing import Any, Dict, List, Optional, Tuple, Type
  from ax.core.base_trial import BaseTrial
  from ax.core.experiment import Experiment
  from ax.core.generation_strategy_interface import GenerationStrategyInterface
  from ax.core.generator_run import GeneratorRun
  from ax.exceptions.core import IncompatibleDependencyVersion, ObjectNotFoundError, UnsupportedError
  from ax.modelbridge.generation_strategy import GenerationStrategy
  from ax.utils.common.executils import retry_on_exception
  from ax.utils.common.logger import _round_floats_for_logging, get_logger
  from ax.utils.common.typeutils import not_none
label_desc: Use image node_id 7 for calling the WithDBSettingsBase obj's underlying member method code with example usage: obj._load_experiment_and_generation_strategy(experiment_name, reduced_state, skip_runners_and_metrics) and returns: experiment,  generation_strategy, experiment,  None