code: def test_basic_states(shutdown_only):
      info = ray.init(num_cpus=3, _system_config=_SYSTEM_CONFIG)
  
      pg1 = ray.util.placement_group(bundles=[{"CPU": 1}])
      pg2 = ray.util.placement_group(bundles=[{"CPU": 1}])
      pg3 = ray.util.placement_group(bundles=[{"CPU": 4}])
      ray.get([pg1.ready(), pg2.ready()])
  
      expected = {
          "CREATED": 2,
          "PENDING": 1,
      }
      wait_for_condition(
          lambda: groups_by_state(info) == expected,
          timeout=20,
          retry_interval_ms=500,
      )
  
      remove_placement_group(pg1)
      remove_placement_group(pg2)
      remove_placement_group(pg3)
  
      expected = {
          "REMOVED": 3,
      }
      wait_for_condition(
          lambda: groups_by_state(info) == expected,
          timeout=20,
          retry_interval_ms=500,
      )
  
file_path: ray/python/ray/tests/test_placement_group_metrics.py
imports: from collections import defaultdict
  import pytest
  from typing import Dict
  import ray
  from ray._private.test_utils import raw_metrics, wait_for_condition
  from ray._private.worker import RayContext
  from ray.util.placement_group import remove_placement_group
label_desc: Use image node_id 2 for calling a global function with example usage: test_basic_states(shutdown_only) without return types