code: def test_placement_group_bin_packing_priority(
      ray_start_cluster, connect_to_client, scheduling_strategy
  ):
      @ray.remote
      class Actor(object):
          def __init__(self):
              self.n = 0
  
          def value(self):
              return self.n
  
      def index_to_actor(pg, index):
          if index < 2:
              return Actor.options(
                  scheduling_strategy=PlacementGroupSchedulingStrategy(
                      placement_group=pg,
                      placement_group_bundle_index=index,
                  ),
                  num_cpus=1,
              ).remote()
          else:
              return Actor.options(
                  scheduling_strategy=PlacementGroupSchedulingStrategy(
                      placement_group=pg,
                      placement_group_bundle_index=index,
                  ),
                  num_gpus=1,
              ).remote()
  
      def add_nodes_to_cluster(cluster):
          cluster.add_node(num_cpus=1)
          cluster.add_node(num_cpus=2)
          cluster.add_node(num_gpus=1)
  
      default_bundles = [
          {"CPU": 1},
          {"CPU": 2},
          {"CPU": 1, "GPU": 1},
      ]
  
      default_num_nodes = len(default_bundles)
      cluster = ray_start_cluster
      add_nodes_to_cluster(cluster)
      ray.init(address=cluster.address)
  
      with connect_to_client_or_not(connect_to_client):
          placement_group = ray.util.placement_group(
              name="name",
              strategy=scheduling_strategy,
              bundles=default_bundles,
          )
          ray.get(placement_group.ready())
  
          actors = [
              index_to_actor(placement_group, i)
              for i in range(default_num_nodes)
          ]
  
          [ray.get(actor.value.remote()) for actor in actors]
  
          # Get all actors.
          actor_infos = ray._private.state.actors()
  
          # Make sure all actors in counter_list are located in separate nodes.
          actor_info_objs = [
              actor_infos.get(actor._actor_id.hex()) for actor in actors
          ]
          assert are_pairwise_unique(
              [
                  info_obj["Address"]["NodeID"]
                  for info_obj in actor_info_objs
              ]
          )
  
file_path: ray/python/ray/tests/test_placement_group_5.py
imports: import sys
  import pytest
  import ray
  from ray.tests.test_placement_group import are_pairwise_unique
  from ray.util.client.ray_client_helpers import connect_to_client_or_not
  from ray.util.scheduling_strategies import PlacementGroupSchedulingStrategy
label_desc: Use image node_id 1 for calling a global function with example usage: test_placement_group_bin_packing_priority(ray_start_cluster, connect_to_client, scheduling_strategy) and returns: self, Actor, Actor