code: def restore(cls,
                  metadata_checkpoint_dir,
                  search_alg=None,
                  scheduler=None,
                  trial_executor=None):
          
  
          newest_ckpt_path = _find_newest_ckpt(metadata_checkpoint_dir)
          with open(newest_ckpt_path, "r") as f:
              runner_state = json.load(f, cls=_TuneFunctionDecoder)
  
          logger.warning("".join([
              "Attempting to resume experiment from {}. ".format(
                  metadata_checkpoint_dir), "This feature is experimental, "
              "and may not work with all search algorithms. ",
              "This will ignore any new changes to the specification."
          ]))
  
          from ray.tune.suggest import BasicVariantGenerator
          runner = TrialRunner(
              search_alg or BasicVariantGenerator(),
              scheduler=scheduler,
              trial_executor=trial_executor)
  
          runner.__setstate__(runner_state["runner_data"])
  
          trials = []
          for trial_cp in runner_state["checkpoints"]:
              new_trial = Trial(trial_cp["trainable_name"])
              new_trial.__setstate__(trial_cp)
              trials += [new_trial]
          for trial in sorted(
                  trials, key=lambda t: t.last_update_time, reverse=True):
              runner.add_trial(trial)
          return runner
docs: Restores all checkpointed trials from previous run.
  
          Requires user to manually re-register their objects. Also stops
          all ongoing trials.
  
          Args:
              metadata_checkpoint_dir (str): Path to metadata checkpoints.
              search_alg (SearchAlgorithm): Search Algorithm. Defaults to
                  BasicVariantGenerator.
              scheduler (TrialScheduler): Scheduler for executing
                  the experiment.
              trial_executor (TrialExecutor): Manage the execution of trials.
  
          Returns:
              runner (TrialRunner): A TrialRunner to resume experiments from.