code: def test_resolve(ray_start_4_cpus, resource_manager_cls):
      """Test that the `on_result` callback is invoked when a task completes.
  
      - Instantiate global data object
      - Schedule task that returns a value
      - The callback writes the returned value to the global data object
      """
      actor_manager = RayActorManager(
          resource_manager=resource_manager_cls()
      )
  
      seen = {"data": 0}
  
      def result_callback(tracked_actor, result):
          seen["data"] = result
  
      tracked_actor = actor_manager.add_actor(
          cls=Actor,
          kwargs={},
          resource_request=ResourceRequest([{"CPU": 4}]),
      )
      actor_manager.schedule_actor_task(
          tracked_actor, "foo", (4, False), on_result=result_callback
      )
      actor_manager.next()
      actor_manager.next()
  
      assert seen["data"] == 4
  
file_path: ray/python/ray/air/tests/execution/test_tracked_actor_task.py
imports: from collections import Counter
  import pytest
  import ray
  from ray.air import ResourceRequest
  from ray.air.execution import FixedResourceManager, PlacementGroupResourceManager
  from ray.air.execution._internal.actor_manager import RayActorManager
label_desc: Use image node_id 2 for calling a global function with example usage: test_resolve(ray_start_4_cpus, resource_manager_cls) without return types