code: def test_finish(ray_start_1_cpu):
      """
      Test that finish callback is called once.
      """
  
      class FinishCallback(RayDaskCallback):
          def __init__(self, finish_actor):
              self.finish_actor = finish_actor
  
          def _ray_finish(self, result):
              self.finish_actor.finish.remote(result)
  
      @ray.remote
      class FinishActor:
          def __init__(self):
              self.finish_called = False
  
          def finish(self, result):
              self.finish_called = True
  
          def get_finish_called(self):
              return self.finish_called
  
      finish_actor = FinishActor.remote()
      with FinishCallback(finish_actor):
          z = add(2, 3)
          result = z.compute(scheduler=ray_dask_get)
  
      assert ray.get(finish_actor.get_finish_called.remote())
      assert result == 5
  
file_path: ray/python/ray/util/dask/tests/test_dask_callback.py
imports: import dask
  import pytest
  import ray
  from ray.util.dask import ray_dask_get, RayDaskCallback
label_desc: Use image node_id 8 for calling a global function with example usage: test_finish(ray_start_1_cpu) and returns: self