class_docstr: A manager for parallel execution of jobs.
  
  A job must be of type :class:`Job` which produces a :class:`Result`
  object upon successful completion. The scheduler maintains a job and
  result queues.
  
  Notes:
      This class should be used as a context manager.
docstr: Exit the scheduler by closing the queues and terminating the
  servant process.
docstr_tok: ["Exit","the","scheduler","by","closing","the","queues","and","terminating","the","servant","process","."]
code: def exit(self):
      """Exit the scheduler by closing the queues and terminating the
      servant process.
      """
      if not self._is_queue_closed:
          utils.drain_queue(self._job_queue, close_queue=True)
          self._job_queue.join_thread()
          utils.drain_queue(self._result_queue, close_queue=True)
          self._result_queue.join_thread()
          self._is_queue_closed = True
      self.interrupt()
      # wait a bit for the subprocess to exit gracefully
      n_retries = 3
      while self._servant.is_alive() and n_retries > 0:
          n_retries -= 1
          time.sleep(0.05)
      self._servant.terminate()
  
file_path: hypertunity/hypertunity/scheduling/scheduler.py
imports: import multiprocessing
  import time
  from typing import List
  import joblib
  from hypertunity import utils
  from .jobs import Job, Result
label_desc: Use image node_id 9 for calling the Scheduler obj's underlying member method code with example usage: obj.exit() without return types