class_docstr: Class to manage a pool of backgrounded threaded jobs.
  
  Below, we assume that 'jobs' is a BackgroundJobManager instance.
  
  Usage summary (see the method docstrings for details):
  
    jobs.new(...) -> start a new job
    
    jobs() or jobs.status() -> print status summary of all jobs
  
    jobs[N] -> returns job number N.
  
    foo = jobs[N].result -> assign to variable foo the result of job N
  
    jobs[N].traceback() -> print the traceback of dead job N
  
    jobs.remove(N) -> remove (finished) job N
  
    jobs.flush() -> remove all finished jobs
    
  As a convenience feature, BackgroundJobManager instances provide the
  utility result and traceback methods which retrieve the corresponding
  information from the jobs list:
  
    jobs.result(N) <--> jobs[N].result
    jobs.traceback(N) <--> jobs[N].traceback()
  
  While this appears minor, it allows you to use tab completion
  interactively on the job manager instance.
docstr: Flush all finished jobs (completed and dead) from lists.
  
  Running jobs are never flushed.
  
  It first calls _status_new(), to update info. If any jobs have
  completed since the last _status_new() call, the flush operation
  aborts.
docstr_tok: ["Flush","all","finished","jobs","(","completed","and","dead",")","from","lists",".","Running","jobs","are","never","flushed",".","It","first","calls","_status_new","(",")",",","to","update","info",".","If","any","jobs","have","completed","since","the","last","_status_new","(",")","call",",","the","flush","operation","aborts","."]
code: def flush(self):
      """Flush all finished jobs (completed and dead) from lists.
  
      Running jobs are never flushed.
  
      It first calls _status_new(), to update info. If any jobs have
      completed since the last _status_new() call, the flush operation
      aborts."""
  
      # Remove the finished jobs from the master dict
      alljobs = self.all
      for job in self.completed + self.dead:
          del alljobs[job.num]
  
      # Now flush these lists completely
      fl_comp = self._group_flush(self.completed, "Completed")
      fl_dead = self._group_flush(self.dead, "Dead")
      if not (fl_comp or fl_dead):
          print("No jobs to flush.")
  
imports: from __future__ import print_function
  import sys
  import threading
  from IPython import get_ipython
  from IPython.core.ultratb import AutoFormattedTB
  from logging import error
  from IPython.utils.py3compat import string_types
label_desc: Use image node_id 14 for calling the BackgroundJobManager obj's underlying member method code with example usage: obj.flush() without return types