code: def test_pretask_posttask_shared_state(ray_start_1_cpu):
      """
      Test that pretask return value is passed to corresponding posttask
      callback.
      """
  
      class PretaskPosttaskCallback(RayDaskCallback):
          def _ray_pretask(self, key, object_refs):
              return key
  
          def _ray_posttask(self, key, result, pre_state):
              assert pre_state == key
  
      with PretaskPosttaskCallback():
          z = add(2, 3)
          result = z.compute(scheduler=ray_dask_get)
  
      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 5 for calling a global function with example usage: test_pretask_posttask_shared_state(ray_start_1_cpu) and returns: key