class_docstr: Simple class to enforce a maximum threshold for the number of trials generated
  by a specific GenerationNode.
  
  Args:
      threshold: the designated maximum number of trials
      enforce: whether or not to enforce the max trial constraint
      only_in_status: optional argument for specifying only checking trials with
          this status. If not specified, all trial statuses are counted.
class_docstr_tok: ["Simple","class","to","enforce","a","maximum","threshold","for","the","number","of","trials","generated","by","a","specific","GenerationNode",".","Args",":","threshold",":","the","designated","maximum","number","of","trials","enforce",":","whether","or","not","to","enforce","the","max","trial","constraint","only_in_status",":","optional","argument","for","specifying","only","checking","trials","with","this","status",".","If","not","specified",",","all","trial","statuses","are","counted","."]
docstr: If the block_continued_generation flag is set, raises an error because the
  remaining TransitionCriterion cannot be completed in the current state.
docstr_tok: ["If","the","block_continued_generation","flag","is","set",",","raises","an","error","because","the","remaining","TransitionCriterion","can","not","be","completed","in","the","current","state","."]
code: def block_continued_generation_error(
      self,
      node_name: Optional[str],
      model_name: Optional[str],
      experiment: Optional[Experiment],
      trials_from_node: Optional[Set[int]] = None,
  ) -> None:
      """If the block_continued_generation flag is set, raises an error because the
      remaining TransitionCriterion cannot be completed in the current state.
      """
      if self.block_gen_if_met:
          raise DataRequiredError(
              "All trials for current model have been generated, but not enough "
              "data has been observed to fit next model. Try again when more data"
              " are available."
          )
  
imports: from abc import abstractmethod
  from logging import Logger
  from typing import List, Optional, Set
  from ax.core.base_trial import TrialStatus
  from ax.core.experiment import Experiment
  from ax.exceptions.generation_strategy import MaxParallelismReachedException
  from ax.modelbridge.generation_strategy import DataRequiredError
  from ax.utils.common.base import SortableBase
  from ax.utils.common.logger import get_logger
  from ax.utils.common.serialization import SerializationMixin, serialize_init_args
label_desc: Use image node_id 2 for calling the MaxTrials obj's underlying member method code with example usage: obj.block_continued_generation_error(node_name, model_name, experiment, trials_from_node) without return types