class_docstr: Simple scheduler which schedules all HPO jobs in sequence without any parallelism.
  The next trial scheduling will be decided based on the available time left within `time_out` setting
  and average time required for a trial to complete multiplied by the fill_factor (0.95) by default to
  accommodate variance in runtimes per HPO run.
  
  Parameters
  ----------
  train_fn : callable
      A task launch function for training.
  resource : dict
      Computation resources. For example, `{'num_cpus':2, 'num_gpus':1}`
  searcher : str
      Searcher (get_config decisions). If str, this is passed to
      searcher_factory along with search_options.
  search_options : dict
      If searcher is str, these arguments are passed to searcher_factory.
  num_trials : int
      Maximum number of jobs run in experiment. One of `num_trials`,
      `time_out` must be given.
  time_out : float
      If given, jobs are started only until this time_out (wall clock time).
      One of `num_trials`, `time_out` must be given.
  reward_attr : str
      Name of reward (i.e., metric to maximize) attribute in data obtained
      from reporter
  time_attr : str
      Name of resource (or time) attribute in data obtained from reporter.
      This attribute is optional for FIFO scheduling, but becomes mandatory
      in multi-fidelity scheduling (e.g., Hyperband).
      Note: The type of resource must be int.
class_docstr_tok: ["Simple","scheduler","which","schedules","all","HPO","jobs","in","sequence","without","any","parallelism",".","The","next","trial","scheduling","will","be","decided","based","on","the","available","time","left","within","`","time_out","`","setting","and","average","time","required","for","a","trial","to","complete","multiplied","by","the","fill_factor","(","0.95",")","by","default","to","accommodate","variance","in","runtimes","per","HPO","run",".","Parameters","--","--","--","--","--","train_fn",":","callable","A","task","launch","function","for","training",".","resource",":","dict","Computation","resources",".","For","example",",","`","{","'num_cpus':2",",","'num_gpus':1","}","`","searcher",":","str","Searcher","(","get_config","decisions",")",".","If","str",",","this","is","passed","to","searcher_factory","along","with","search_options",".","search_options",":","dict","If","searcher","is","str",",","these","arguments","are","passed","to","searcher_factory",".","num_trials",":","int","Maximum","number","of","jobs","run","in","experiment",".","One","of","`","num_trials","`",",","`","time_out","`","must","be","given",".","time_out",":","float","If","given",",","jobs","are","started","only","until","this","time_out","(","wall","clock","time",")",".","One","of","`","num_trials","`",",","`","time_out","`","must","be","given",".","reward_attr",":","str","Name","of","reward","(","i.e.",",","metric","to","maximize",")","attribute","in","data","obtained","from","reporter","time_attr",":","str","Name","of","resource","(","or","time",")","attribute","in","data","obtained","from","reporter",".","This","attribute","is","optional","for","FIFO","scheduling",",","but","becomes","mandatory","in","multi-fidelity","scheduling","(","e.g.",",","Hyperband",")",".","Note",":","The","type","of","resource","must","be","int","."]
docstr: Run multiple trials given specific time and trial numbers limits.
docstr_tok: ["Run","multiple","trials","given","specific","time","and","trial","numbers","limits","."]
code: def run(self, **kwargs):
      """Run multiple trials given specific time and trial numbers limits."""
      self.searcher.configure_scheduler(self)
  
      self.training_history = OrderedDict()
      self.config_history = OrderedDict()
  
      failure_count = 0
      trial_count = 0
      trials_total_time = 0
      min_failure_threshold = 5
      failure_rate_threshold = 0.8
      time_start = time.time()
  
      r = range(self.num_trials)
      for i in tqdm(r) if self.num_trials < 1000 else r:
          trial_start_time = time.time()
          try:
              is_failed, result = self.run_trial(task_id=i)
          except ExhaustedSearchSpaceError:
              break
          except Exception:
              # TODO: Add special exception type when there are no more new configurations to try (exhausted search space)
              logger.log(
                  30,
                  f"\tWARNING: Encountered unexpected exception during trial {i}, stopping HPO early.",
              )
              logger.exception(
                  "Detailed Traceback:"
              )  # TODO: Avoid logging if verbosity=0
              break
          trial_end_time = time.time()
  
          trial_count += 1
          if is_failed:
              failure_count += 1
          else:
              trials_total_time += trial_end_time - trial_start_time
  
          if (
              self.max_reward
              and self.get_best_reward() >= self.max_reward
          ):
              logger.log(20, f"\tStopping HPO: Max reward reached")
              break
  
          if (
              failure_count >= min_failure_threshold
              and (failure_count / trial_count)
              >= failure_rate_threshold
          ):
              logger.warning(
                  f"Warning: Detected a large trial failure rate: "
                  f"{failure_count}/{trial_count} attempted trials failed ({round((failure_count / trial_count) * 100, 1)}%)! "
                  f"Stopping HPO early due to reaching failure threshold ({round(failure_rate_threshold*100, 1)}%).\n"
                  f"\tFailures may be caused by invalid configurations within the provided search space."
              )
              break
  
          if self.time_out is not None:
              avg_trial_run_time = (
                  0
                  if trial_count == failure_count
                  else trials_total_time / (trial_count - failure_count)
              )
              if not self.has_enough_time_for_trial_(
                  self.time_out,
                  time_start,
                  trial_start_time,
                  trial_end_time,
                  avg_trial_run_time,
              ):
                  logger.log(
                      20, f"\tStopping HPO to satisfy time limit..."
                  )
                  break
  
imports: import logging
  import os
  import time
  from collections import OrderedDict
  from copy import deepcopy
  from typing import Tuple
  from tqdm.auto import tqdm
  from ..searcher import searcher_factory
  from ..searcher.exceptions import ExhaustedSearchSpaceError
  from ..searcher.local_searcher import LocalSearcher
  from .reporter import FakeReporter
label_desc: Use image node_id 4 for calling the LocalSequentialScheduler obj's underlying member method code with example usage: obj.run() without return types