code: def test_get_locations_multi_nodes(ray_start_cluster_enabled):
      cluster = ray_start_cluster_enabled
      # head node
      cluster.add_node(num_cpus=1, object_store_memory=75 * 1024 * 1024)
      ray.init(cluster.address)
      # add 1 worker node
      cluster.add_node(
          num_cpus=0,
          resources={"custom": 1},
          object_store_memory=75 * 1024 * 1024,
      )
      cluster.wait_for_nodes()
  
      all_node_ids = list(map(lambda node: node["NodeID"], ray.nodes()))
      driver_node_id = ray.get_runtime_context().get_node_id()
      all_node_ids.remove(driver_node_id)
      worker_node_id = all_node_ids[0]
  
      @ray.remote(num_cpus=0, resources={"custom": 1})
      def create_object():
          return np.random.rand(1 * 1024 * 1024)
  
      @ray.remote
      def task():
          return [create_object.remote()]
  
      object_refs = ray.get(task.remote())
      ray.wait(object_refs)
      locations = ray.experimental.get_object_locations(object_refs)
      for obj_ref in object_refs:
          location = locations[obj_ref]
          assert set(location["node_ids"]) == {
              driver_node_id,
              worker_node_id,
          }
          assert location["object_size"] > 0
  
file_path: ray/python/ray/tests/test_get_locations.py
imports: import time
  import numpy
  import pytest
  import ray
label_desc: Use image node_id 7 for calling a global function with example usage: test_get_locations_multi_nodes(ray_start_cluster_enabled) and returns: np, list