code: def test_presubmit_shortcircuit(ray_start_1_cpu):
      """
      Test that presubmit return short-circuits task submission, and that task's
      result is set to the presubmit return value.
      """
  
      class PresubmitShortcircuitCallback(RayDaskCallback):
          def _ray_presubmit(self, task, key, deps):
              return 0
  
          def _ray_postsubmit(self, task, key, deps, object_ref):
              pytest.fail(
                  "_ray_postsubmit shouldn't be called when "
                  "_ray_presubmit returns a value"
              )
  
      with PresubmitShortcircuitCallback():
          z = add(2, 3)
          result = z.compute(scheduler=ray_dask_get)
  
      assert result == 0
  
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 4 for calling a global function with example usage: test_presubmit_shortcircuit(ray_start_1_cpu) and returns: int