code: def test_get_rank(ray_start_single_node_2_gpus):
      world_size = 2
      actors, _ = create_collective_workers(world_size)
      actor0_rank = ray.get(actors[0].report_rank.remote())
      assert actor0_rank == 0
      actor1_rank = ray.get(actors[1].report_rank.remote())
      assert actor1_rank == 1
  
      # create a second group with a different name,
      # and different order of ranks.
      new_group_name = "default2"
      ray.get(
          [
              actor.init_group.remote(
                  world_size,
                  world_size - 1 - i,
                  group_name=new_group_name,
              )
              for i, actor in enumerate(actors)
          ]
      )
      actor0_rank = ray.get(
          actors[0].report_rank.remote(new_group_name)
      )
      assert actor0_rank == 1
      actor1_rank = ray.get(
          actors[1].report_rank.remote(new_group_name)
      )
      assert actor1_rank == 0
  
file_path: ray/python/ray/util/collective/tests/single_node_gpu_tests/test_basic_apis.py
imports: import pytest
  import ray
  from ray.util.collective.tests.util import Worker, create_collective_workers
label_desc: Use image node_id 3 for calling a global function with example usage: test_get_rank(ray_start_single_node_2_gpus) without return types