code: def test_assert_eq_scheduler(a, b):
      counter = (
          0  # Counts how many times `custom_scheduler` is executed.
      )
  
      def custom_scheduler(*args, **kwargs):
          nonlocal counter
          counter += 1
          return get_sync(*args, **kwargs)
  
      assert_eq(a, b)
      assert counter == 0
  
      assert_eq(a, b, scheduler=custom_scheduler)
      # `custom_scheduler` should be executed 2x the number of arrays.
      # Once in `persist` and once in `compute`
      n_da_arrays = len([x for x in [a, b] if isinstance(x, Array)]) * 2
      assert counter == n_da_arrays
  
file_path: dask/dask/array/tests/test_array_utils.py
imports: from __future__ import annotations
  import numpy
  import pytest
  import dask.array
  from dask.array.core import Array
  from dask.array.utils import assert_eq, meta_from_array
  from dask.local import get_sync
label_desc: Use image node_id 5 for calling a global function with example usage: test_assert_eq_scheduler(a, b) and returns: get_sync