class_docstr: A concurrent.futures Executor that executes tasks on a dask.distributed Client.
class_docstr_tok: ["A","concurrent.futures","Executor","that","executes","tasks","on","a","dask.distributed","Client","."]
docstr: Wrap a distributed Future in a concurrent.futures Future.
docstr_tok: ["Wrap","a","distributed","Future","in","a","concurrent.futures","Future","."]
code: def _wrap_future(self, future):
      """
      Wrap a distributed Future in a concurrent.futures Future.
      """
      cf_future = cf.Future()
  
      # Support cancelling task through .cancel() on c.f.Future
      def cf_callback(cf_future):
          if cf_future.cancelled() and future.status != "cancelled":
              future.cancel()
  
      cf_future.add_done_callback(cf_callback)
  
      self._client.loop.add_callback(_cascade_future, future, cf_future)
      return cf_future
  
file_path: distributed/distributed/cfexecutor.py
imports: from __future__ import annotations
  import concurrent.futures
  import weakref
  from tlz import merge
  from tornado import gen
  from dask.utils import parse_timedelta
  from distributed.metrics import time
  from distributed.utils import TimeoutError, sync
label_desc: Use image node_id 2 for calling the ClientExecutor obj's underlying member method code with example usage: obj._wrap_future(future) and returns: cf_future