code: def test_placement_group_pack(
      ray_start_cluster, connect_to_client, gcs_actor_scheduling_enabled
  ):
      @ray.remote(num_cpus=2)
      class Actor(object):
          def __init__(self):
              self.n = 0
  
          def value(self):
              return self.n
  
      cluster = ray_start_cluster
      num_nodes = 2
      for i in range(num_nodes):
          cluster.add_node(
              num_cpus=4,
              _system_config={
                  "gcs_actor_scheduling_enabled": gcs_actor_scheduling_enabled
              }
              if i == 0
              else {},
          )
      ray.init(address=cluster.address)
  
      with connect_to_client_or_not(connect_to_client):
          placement_group = ray.util.placement_group(
              name="name",
              strategy="PACK",
              bundles=[
                  {
                      "CPU": 2,
                      "GPU": 0,
                  },  # Test 0 resource spec doesn't break tests.
                  {"CPU": 2},
              ],
          )
          ray.get(placement_group.ready())
          actor_1 = Actor.options(
              scheduling_strategy=PlacementGroupSchedulingStrategy(
                  placement_group=placement_group,
                  placement_group_bundle_index=0,
              )
          ).remote()
          actor_2 = Actor.options(
              scheduling_strategy=PlacementGroupSchedulingStrategy(
                  placement_group=placement_group,
                  placement_group_bundle_index=1,
              )
          ).remote()
  
          ray.get(actor_1.value.remote())
          ray.get(actor_2.value.remote())
  
          # Get all actors.
          actor_infos = ray._private.state.actors()
  
          # Make sure all actors in counter_list are collocated in one node.
          actor_info_1 = actor_infos.get(actor_1._actor_id.hex())
          actor_info_2 = actor_infos.get(actor_2._actor_id.hex())
  
          assert actor_info_1 and actor_info_2
  
          node_of_actor_1 = actor_info_1["Address"]["NodeID"]
          node_of_actor_2 = actor_info_2["Address"]["NodeID"]
          assert node_of_actor_1 == node_of_actor_2
          placement_group_assert_no_leak([placement_group])
  
imports: import sys
  import warnings
  import os
  import pytest
  import ray
  from ray._private.utils import get_ray_doc_version
  import ray.cluster_utils
  from ray._private.test_utils import placement_group_assert_no_leak
  from ray._private.test_utils import skip_flaky_core_test_premerge
  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 4 for calling a global function with example usage: test_placement_group_pack(ray_start_cluster, connect_to_client, gcs_actor_scheduling_enabled) and returns: self