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: Saves given generation strategy if DB settings are set on this
  `WithDBSettingsBase` instance and the generation strategy is an
  instance of `GenerationStrategy`.
  
  Args:
      generation_strategy: GenerationStrategyInterface to update in DB.
          For now, only instances of  GenerationStrategy will be updated.
          Otherwise, this function is a no-op.
  
  Returns:
      bool: Whether the generation strategy was saved.
docstr_tok: ["Saves","given","generation","strategy","if","DB","settings","are","set","on","this","`","WithDBSettingsBase","`","instance","and","the","generation","strategy","is","an","instance","of","`","GenerationStrategy","`",".","Args",":","generation_strategy",":","GenerationStrategyInterface","to","update","in","DB",".","For","now",",","only","instances","of","GenerationStrategy","will","be","updated",".","Otherwise",",","this","function","is","a","no-op",".","Returns",":","bool",":","Whether","the","generation","strategy","was","saved","."]
code: def _save_generation_strategy_to_db_if_possible(
      self,
      generation_strategy: Optional[GenerationStrategyInterface] = None,
      suppress_all_errors: bool = False,
  ) -> bool:
      """Saves given generation strategy if DB settings are set on this
      `WithDBSettingsBase` instance and the generation strategy is an
      instance of `GenerationStrategy`.
  
      Args:
          generation_strategy: GenerationStrategyInterface to update in DB.
              For now, only instances of  GenerationStrategy will be updated.
              Otherwise, this function is a no-op.
  
      Returns:
          bool: Whether the generation strategy was saved.
      """
      if self.db_settings_set and generation_strategy is not None:
          # only local GenerationStrategies should need to be saved to
          # the database because only they make changes locally
          if isinstance(generation_strategy, GenerationStrategy):
              _save_generation_strategy_to_db_if_possible(
                  generation_strategy=generation_strategy,
                  encoder=self.db_settings.encoder,
                  decoder=self.db_settings.decoder,
                  suppress_all_errors=self._suppress_all_errors,
              )
              return True
      return False
  
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 12 for calling the WithDBSettingsBase obj's underlying member method code with example usage: obj._save_generation_strategy_to_db_if_possible(generation_strategy, suppress_all_errors) and returns: False, True