class_docstr: Run the optimization process given the current executor
class_docstr_tok: ["Run","the","optimization","process","given","the","current","executor"]
docstr: Run the optimizing process until completion.
  
  Returns
  -------
  the total number of trials processed
docstr_tok: ["Run","the","optimizing","process","until","completion",".","Returns","--","--","--","-","the","total","number","of","trials","processed"]
code: def run(self):
      """Run the optimizing process until completion.
  
      Returns
      -------
      the total number of trials processed
  
      """
      idle_start = time.time()
      idle_end = 0
      idle_time = 0
  
      while self.is_running:
          try:
              # Get new trials for our free workers
              with self.stat.time("sample"):
                  new_trials = self.sample()
  
              # Scatter the new trials to our free workers
              with self.stat.time("scatter"):
                  scattered = self.scatter(new_trials)
  
              # Protected will prevent Keyboard interrupts from
              # happening in the middle of the scatter-gather process
              # that we can be sure that completed trials are observed
              with Protected():
                  # Gather the results of the workers that have finished
                  with self.stat.time("gather"):
                      gathered = self.gather()
  
                  if scattered == 0 and gathered == 0 and self.is_idle:
                      idle_end = time.time()
                      idle_time += idle_end - idle_start
                      idle_start = idle_end
  
                      log.debug(
                          f"Workers have been idle for {idle_time:.2f} s"
                      )
                  else:
                      idle_start = time.time()
                      idle_time = 0
  
                  if self.is_idle and idle_time > self.idle_timeout:
                      msg = f"Workers have been idle for {idle_time:.2f} s"
  
                      if self.has_remaining and not self.is_done:
                          msg = (
                              f"{msg}; worker has leg room (has_remaining: {self.has_remaining})"
                              f" and optimization is not done (is_done: {self.is_done})"
                          )
  
                      raise LazyWorkers(msg)
  
          except KeyboardInterrupt:
              self._release_all()
              raise
          except:
              self._release_all()
              raise
  
      return self.trials
  
imports: from __future__ import annotations
  import logging
  import os
  import shutil
  import signal
  import time
  import typing
  import warnings
  from contextlib import contextmanager
  from dataclasses import dataclass
  from typing import Callable
  import orion.core
  from orion.core.utils import backward
  from orion.core.utils.exceptions import BrokenExperiment, CompletedExperiment, InvalidResult, LazyWorkers, ReservationRaceCondition, WaitingForTrials
  from orion.core.utils.flatten import flatten, unflatten
  from orion.core.worker.consumer import ExecutionError
  from orion.core.worker.trial import AlreadyReleased
  from orion.executor.base import AsyncException, AsyncResult
  from orion.storage.base import LockAcquisitionTimeout
label_desc: Use image node_id 8 for calling the Runner obj's underlying member method code with example usage: obj.run() and returns: self