code: def step(self):
          
          if self.is_finished():
              raise TuneError("Called step when all trials finished?")
          with warn_if_slow("on_step_begin"):
              self.trial_executor.on_step_begin()
          next_trial = self._get_next_trial()  # blocking
          if next_trial is not None:
              with warn_if_slow("start_trial"):
                  self.trial_executor.start_trial(next_trial)
          elif self.trial_executor.get_running_trials():
              self._process_events()  # blocking
          else:
              for trial in self._trials:
                  if trial.status == Trial.PENDING:
                      if not self.has_resources(trial.resources):
                          raise TuneError(
                              ("Insufficient cluster resources to launch trial: "
                               "trial requested {} but the cluster has only {}. "
                               "Pass `queue_trials=True` in "
                               "ray.tune.run() or on the command "
                               "line to queue trials until the cluster scales "
                               "up. {}").format(
                                   trial.resources.summary_string(),
                                   self.trial_executor.resource_string(),
                                   trial._get_trainable_cls().resource_help(
                                       trial.config)))
                  elif trial.status == Trial.PAUSED:
                      raise TuneError(
                          "There are paused trials, but no more pending "
                          "trials with sufficient resources.")
  
          try:
              with warn_if_slow("experiment_checkpoint"):
                  self.checkpoint()
          except Exception:
              logger.exception("Trial Runner checkpointing failed.")
          self._iteration += 1
  
          if self._server:
              with warn_if_slow("server"):
                  self._process_requests()
  
              if self.is_finished():
                  self._server.shutdown()
          with warn_if_slow("on_step_end"):
              self.trial_executor.on_step_end()
docs: Runs one step of the trial event loop.
  
          Callers should typically run this method repeatedly in a loop. They
          may inspect or modify the runner's state in between calls to step().