class_docstr: Event manager for Ray futures.
  
  The event manager can be used to track futures and invoke callbacks when
  they resolve.
  
  Futures are tracked with :meth:`track_future`. Future can then be awaited with
  :meth:`wait`. When futures successfully resolve, they trigger an optional
  ``on_result`` callback that can be passed to :meth:`track_future`. If they
  fail, they trigger an optional ``on_error`` callback.
  
  Args:
      shuffle_futures: If True, futures will be shuffled before awaited. This
          will avoid implicit prioritization of futures within Ray.
docstr: Track a single future and invoke callbacks on resolution.
  
  Control has to be yielded to the event manager for the callbacks to
  be invoked, either via :meth:`wait` or via :meth:`resolve_future`.
  
  Args:
      future: Ray future to await.
      on_result: Callback to invoke when the future resolves successfully.
      on_error: Callback to invoke when the future fails.
code: def track_future(
      self,
      future: ray.ObjectRef,
      on_result: Optional[_ResultCallback] = None,
      on_error: Optional[_ErrorCallback] = None,
  ):
      """Track a single future and invoke callbacks on resolution.
  
      Control has to be yielded to the event manager for the callbacks to
      be invoked, either via :meth:`wait` or via :meth:`resolve_future`.
  
      Args:
          future: Ray future to await.
          on_result: Callback to invoke when the future resolves successfully.
          on_error: Callback to invoke when the future fails.
  
      """
      self._tracked_futures[future] = (on_result, on_error)
  
file_path: ray/python/ray/air/execution/_internal/event_manager.py
imports: import random
  import ray
  from typing import Any, Callable, Dict, Iterable, Optional, Set, Tuple, Union
label_desc: Use image node_id 2 for calling the RayEventManager obj's underlying member method code with example usage: obj.track_future(future, on_result, on_error) without return types