class_docstr: A progress bar for dask.
  
  Parameters
  ----------
  minimum : int, optional
      Minimum time threshold in seconds before displaying a progress bar.
      Default is 0 (always display)
  width : int, optional
      Width of the bar
  dt : float, optional
      Update resolution in seconds, default is 0.1 seconds
  out : file object, optional
      File object to which the progress bar will be written
      It can be ``sys.stdout``, ``sys.stderr`` or any other file object able to write ``str`` objects
      Default is ``sys.stdout``
  
  Examples
  --------
  
  Below we create a progress bar with a minimum threshold of 1 second before
  displaying. For cheap computations nothing is shown:
  
  >>> with ProgressBar(minimum=1.0):      # doctest: +SKIP
  ...     out = some_fast_computation.compute()
  
  But for expensive computations a full progress bar is displayed:
  
  >>> with ProgressBar(minimum=1.0):      # doctest: +SKIP
  ...     out = some_slow_computation.compute()
  [########################################] | 100% Completed | 10.4 s
  
  The duration of the last computation is available as an attribute
  
  >>> pbar = ProgressBar()                # doctest: +SKIP
  >>> with pbar:                          # doctest: +SKIP
  ...     out = some_computation.compute()
  [########################################] | 100% Completed | 10.4 s
  >>> pbar.last_duration                  # doctest: +SKIP
  10.4
  
  You can also register a progress bar so that it displays for all
  computations:
  
  >>> pbar = ProgressBar()                # doctest: +SKIP
  >>> pbar.register()                     # doctest: +SKIP
  >>> some_slow_computation.compute()     # doctest: +SKIP
  [########################################] | 100% Completed | 10.4 s
class_docstr_tok: ["A","progress","bar","for","dask",".","Parameters","--","--","--","--","--","minimum",":","int",",","optional","Minimum","time","threshold","in","seconds","before","displaying","a","progress","bar",".","Default","is","0","(","always","display",")","width",":","int",",","optional","Width","of","the","bar","dt",":","float",",","optional","Update","resolution","in","seconds",",","default","is","0.1","seconds","out",":","file","object",",","optional","File","object","to","which","the","progress","bar","will","be","written","It","can","be","``","sys.stdout","``",",","``","sys.stderr","``","or","any","other","file","object","able","to","write","``","str","``","objects","Default","is","``","sys.stdout","``","Examples","--","--","--","--","Below","we","create","a","progress","bar","with","a","minimum","threshold","of","1","second","before","displaying",".","For","cheap","computations","nothing","is","shown",":",">",">",">","with","ProgressBar","(","minimum=1.0",")",":","#","doctest",":","+SKIP","...","out","=","some_fast_computation.compute","(",")","But","for","expensive","computations","a","full","progress","bar","is","displayed",":",">",">",">","with","ProgressBar","(","minimum=1.0",")",":","#","doctest",":","+SKIP","...","out","=","some_slow_computation.compute","(",")","[","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","]","|","100","%","Completed","|","10.4","s","The","duration","of","the","last","computation","is","available","as","an","attribute",">",">",">","pbar","=","ProgressBar","(",")","#","doctest",":","+SKIP",">",">",">","with","pbar",":","#","doctest",":","+SKIP","...","out","=","some_computation.compute","(",")","[","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","]","|","100","%","Completed","|","10.4","s",">",">",">","pbar.last_duration","#","doctest",":","+SKIP","10.4","You","can","also","register","a","progress","bar","so","that","it","displays","for","all","computations",":",">",">",">","pbar","=","ProgressBar","(",")","#","doctest",":","+SKIP",">",">",">","pbar.register","(",")","#","doctest",":","+SKIP",">",">",">","some_slow_computation.compute","(",")","#","doctest",":","+SKIP","[","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","#","]","|","100","%","Completed","|","10.4","s"]
code: def _finish(self, dsk, state, errored):
      self._running = False
      self._timer.join()
      elapsed = default_timer() - self._start_time
      self.last_duration = elapsed
      if elapsed < self._minimum:
          return
      if not errored:
          self._draw_bar(1, elapsed)
      else:
          self._update_bar(elapsed)
      if self._file is not None:
          self._file.write("\n")
          self._file.flush()
  
file_path: dask/dask/diagnostics/progress.py
imports: from __future__ import annotations
  import contextlib
  import sys
  import threading
  import time
  from timeit import default_timer
  from dask.callbacks import Callback
  from dask.utils import _deprecated
label_desc: Use image node_id 4 for calling the ProgressBar obj's underlying member method code with example usage: obj._finish(dsk, state, errored) without return types