class_docstr: Bookkeeping system to track the cutoffs.
  
  Rungs are created in reversed order so that we can more easily find
  the correct rung corresponding to the current iteration of the result.
  
  Example:
      >>> trial1, trial2, trial3 = ... # doctest: +SKIP
      >>> b = _Bracket(1, 10, 2, 0) # doctest: +SKIP
      >>> # CONTINUE
      >>> b.on_result(trial1, 1, 2) # doctest: +SKIP
      >>> # CONTINUE
      >>> b.on_result(trial2, 1, 4) # doctest: +SKIP
      >>> # rungs are reversed
      >>> b.cutoff(b._rungs[-1][1]) == 3.0 # doctest: +SKIP
       # STOP
      >>> b.on_result(trial3, 1, 1) # doctest: +SKIP
      >>> b.cutoff(b._rungs[3][1]) == 2.0 # doctest: +SKIP
class_docstr_tok: ["Bookkeeping","system","to","track","the","cutoffs",".","Rungs","are","created","in","reversed","order","so","that","we","can","more","easily","find","the","correct","rung","corresponding","to","the","current","iteration","of","the","result",".","Example",":",">",">",">","trial1",",","trial2",",","trial3","=","...","#","doctest",":","+SKIP",">",">",">","b","=","_Bracket","(","1",",","10",",","2",",","0",")","#","doctest",":","+SKIP",">",">",">","#","CONTINUE",">",">",">","b.on_result","(","trial1",",","1",",","2",")","#","doctest",":","+SKIP",">",">",">","#","CONTINUE",">",">",">","b.on_result","(","trial2",",","1",",","4",")","#","doctest",":","+SKIP",">",">",">","#","rungs","are","reversed",">",">",">","b.cutoff","(","b._rungs","[","-1","]","[","1","]",")","==","3.0","#","doctest",":","+SKIP","#","STOP",">",">",">","b.on_result","(","trial3",",","1",",","1",")","#","doctest",":","+SKIP",">",">",">","b.cutoff","(","b._rungs","[","3","]","[","1","]",")","==","2.0","#","doctest",":","+SKIP"]
code: def on_result(
      self, trial: Trial, cur_iter: int, cur_rew: Optional[float]
  ) -> str:
      action = TrialScheduler.CONTINUE
      for milestone, recorded in self._rungs:
          if (
              cur_iter >= milestone
              and trial.trial_id in recorded
              and not self._stop_last_trials
          ):
              # If our result has been recorded for this trial already, the
              # decision to continue training has already been made. Thus we can
              # skip new cutoff calculation and just continue training.
              # We can also break as milestones are descending.
              break
          if cur_iter < milestone or trial.trial_id in recorded:
              continue
          else:
              cutoff = self.cutoff(recorded)
              if cutoff is not None and cur_rew < cutoff:
                  action = TrialScheduler.STOP
              if cur_rew is None:
                  logger.warning(
                      "Reward attribute is None! Consider"
                      " reporting using a different field."
                  )
              else:
                  recorded[trial.trial_id] = cur_rew
              break
      return action
  
imports: import logging
  from typing import Dict, Optional, Union, TYPE_CHECKING
  import numpy
  import pickle
  from ray.tune.result import DEFAULT_METRIC
  from ray.tune.schedulers.trial_scheduler import FIFOScheduler, TrialScheduler
  from ray.tune.experiment import Trial
  from ray.util import PublicAPI
label_desc: Use image node_id 3 for calling the _Bracket obj's underlying member method code with example usage: obj.on_result(trial, cur_iter, cur_rew) and returns: action