code: def test_track_future_error(ray_start_4_cpus):
      """Schedule a future that fails.
  
      Check that the on_error callback was triggered.
      """
      event_manager = RayEventManager()
  
      seen = set()
  
      class CustomError(RuntimeError):
          pass
  
      def on_error(exception: Exception):
          seen.add(exception)
  
      event_manager.track_future(
          failing.remote(CustomError), on_error=on_error
      )
  
      event_manager.wait()
      assert isinstance(seen.pop(), CustomError)
  
      assert not event_manager._tracked_futures
  
file_path: ray/python/ray/air/tests/execution/test_event_manager.py
imports: import time
  from typing import Any, Type
  import pytest
  import ray
  from ray.air.execution._internal import Barrier
  from ray.air.execution._internal.event_manager import RayEventManager
  from ray.exceptions import RayTaskError
label_desc: Use image node_id 7 for calling a global function with example usage: test_track_future_error(ray_start_4_cpus) without return types