title: Dask add_done_callback with other args?
body: <p>I'm looking to add a callback to a future once it is finished.</p>
  
  <p>Per the documentation:</p>
  
  <blockquote>
    <p>Call callback on future when callback has finished.</p>
    
    <p>The callback fn should take the future as its only argument. This will be called regardless of if the future completes successfully, errs, or is cancelled.</p>
    
    <p>The callback is executed in a separate thread.</p>
  </blockquote>
  
  <p>This doesn't provide me with what I need because of the requirement for callback fn to take future as its only argument.</p>
  
  <p>Here's a sample portion code of what I am tying to do:</p>
  
  <pre><code>def method(cu_device_id):
      print("Hello world, I'm going to use GPU %i" % cu_device_id)
  
  def callback_fn(cu_device_id)
      gpu_queue.put(cu_device_id)
  
  cu_device_id = gpu_queue.get()
  future = client.submit(method, cu_device_id)
  #gpu_queue.put(cu_device_id) # Does not work, clients will shortly end up piled onto the slowest GPU
  result.add_done_callback(callback_fn) # Crash / no way to pass in cu_device_id
  </code></pre>
  
  <p>The idea here is to have a client take an available GPU from the queue, and then once it is finished using it, put it back into the queue so that another client can use it.</p>
  
  <p>One way to get around this is to pass gpu_queue into client:</p>
  
  <pre><code>def method(gpu_queue):
      cu_device_id = gpu_queue.get()
      print("Hello world, I'm going to use GPU %i" % cu_device_id)
      gpu_queue.put(cu_device_id)
  
  future = client.submit(method, gpu_queue)
  </code></pre>
  
  <p>Things work as expected like this. <strong>But I prefer to be able to do this from outside</strong> What I missing or not seeing to make this work?</p>
  
  <p>Thanks</p>