class_docstr: A plugin for the client allowing replay of remote tasks locally
  
  Adds the following methods to the given client:
  
  - ``recreate_error_locally``: main user method for replaying failed tasks
  - ``recreate_task_locally``: main user method for replaying any task
class_docstr_tok: ["A","plugin","for","the","client","allowing","replay","of","remote","tasks","locally","Adds","the","following","methods","to","the","given","client",":","-","``","recreate_error_locally","``",":","main","user","method","for","replaying","failed","tasks","-","``","recreate_task_locally","``",":","main","user","method","for","replaying","any","task"]
docstr: For a failed calculation, perform the blamed task locally for debugging.
  
  This operation should be performed after a future (result of ``gather``,
  ``compute``, etc) comes back with a status of "error", if the stack-
  trace is not informative enough to diagnose the problem. The specific
  task (part of the graph pointing to the future) responsible for the
  error will be fetched from the scheduler, together with the values of
  its inputs. The function will then be executed, so that ``pdb`` can
  be used for debugging.
  
  Examples
  --------
  >>> future = c.submit(div, 1, 0)         # doctest: +SKIP
  >>> future.status                        # doctest: +SKIP
  'error'
  >>> c.recreate_error_locally(future)     # doctest: +SKIP
  ZeroDivisionError: division by zero
  
  If you're in IPython you might take this opportunity to use pdb
  
  >>> %pdb                                 # doctest: +SKIP
  Automatic pdb calling has been turned ON
  
  >>> c.recreate_error_locally(future)     # doctest: +SKIP
  ZeroDivisionError: division by zero
        1 def div(x, y):
  ----> 2     return x / y
  ipdb>
  
  Parameters
  ----------
  future : future or collection that failed
      The same thing as was given to ``gather``, but came back with
      an exception/stack-trace. Can also be a (persisted) dask collection
      containing any errored futures.
  
  Returns
  -------
  Nothing; the function runs and should raise an exception, allowing
  the debugger to run.
docstr_tok: ["For","a","failed","calculation",",","perform","the","blamed","task","locally","for","debugging",".","This","operation","should","be","performed","after","a","future","(","result","of","``","gather","``",",","``","compute","``",",","etc",")","comes","back","with","a","status","of","``","error","''",",","if","the","stack-","trace","is","not","informative","enough","to","diagnose","the","problem",".","The","specific","task","(","part","of","the","graph","pointing","to","the","future",")","responsible","for","the","error","will","be","fetched","from","the","scheduler",",","together","with","the","values","of","its","inputs",".","The","function","will","then","be","executed",",","so","that","``","pdb","``","can","be","used","for","debugging",".","Examples","--","--","--","--",">",">",">","future","=","c.submit","(","div",",","1",",","0",")","#","doctest",":","+SKIP",">",">",">","future.status","#","doctest",":","+SKIP","'error'",">",">",">","c.recreate_error_locally","(","future",")","#","doctest",":","+SKIP","ZeroDivisionError",":","division","by","zero","If","you","'re","in","IPython","you","might","take","this","opportunity","to","use","pdb",">",">",">","%","pdb","#","doctest",":","+SKIP","Automatic","pdb","calling","has","been","turned","ON",">",">",">","c.recreate_error_locally","(","future",")","#","doctest",":","+SKIP","ZeroDivisionError",":","division","by","zero","1","def","div","(","x",",","y",")",":","--","--",">","2","return","x","\/","y","ipdb",">","Parameters","--","--","--","--","--","future",":","future","or","collection","that","failed","The","same","thing","as","was","given","to","``","gather","``",",","but","came","back","with","an","exception\/stack-trace",".","Can","also","be","a","(","persisted",")","dask","collection","containing","any","errored","futures",".","Returns","--","--","--","-","Nothing",";","the","function","runs","and","should","raise","an","exception",",","allowing","the","debugger","to","run","."]
code: def recreate_error_locally(self, future):
      """
      For a failed calculation, perform the blamed task locally for debugging.
  
      This operation should be performed after a future (result of ``gather``,
      ``compute``, etc) comes back with a status of "error", if the stack-
      trace is not informative enough to diagnose the problem. The specific
      task (part of the graph pointing to the future) responsible for the
      error will be fetched from the scheduler, together with the values of
      its inputs. The function will then be executed, so that ``pdb`` can
      be used for debugging.
  
      Examples
      --------
      >>> future = c.submit(div, 1, 0)         # doctest: +SKIP
      >>> future.status                        # doctest: +SKIP
      'error'
      >>> c.recreate_error_locally(future)     # doctest: +SKIP
      ZeroDivisionError: division by zero
  
      If you're in IPython you might take this opportunity to use pdb
  
      >>> %pdb                                 # doctest: +SKIP
      Automatic pdb calling has been turned ON
  
      >>> c.recreate_error_locally(future)     # doctest: +SKIP
      ZeroDivisionError: division by zero
            1 def div(x, y):
      ----> 2     return x / y
      ipdb>
  
      Parameters
      ----------
      future : future or collection that failed
          The same thing as was given to ``gather``, but came back with
          an exception/stack-trace. Can also be a (persisted) dask collection
          containing any errored futures.
  
      Returns
      -------
      Nothing; the function runs and should raise an exception, allowing
      the debugger to run.
      """
      errored_future_key = sync(
          self.client.loop, self._get_errored_future, future
      )
      return self.recreate_task_locally(errored_future_key)
  
file_path: distributed/distributed/recreate_tasks.py
imports: from __future__ import annotations
  import logging
  from dask.core import validate_key
  from distributed.client import Future, futures_of, wait
  from distributed.protocol.serialize import ToPickle
  from distributed.utils import sync
  from distributed.utils_comm import pack_data
label_desc: Use image node_id 4 for calling the ReplayTaskClient obj's underlying member method code with example usage: obj.recreate_error_locally(future) and returns: self