code: def test_placement_group_removal_idle_node():
      # Test that nodes become idle after placement group removal.
      cluster = AutoscalingCluster(
          head_resources={"CPU": 2},
          worker_node_types={
              "type-1": {
                  "resources": {"CPU": 2},
                  "node_config": {},
                  "min_workers": 0,
                  "max_workers": 2,
              },
          },
      )
      try:
          cluster.start()
          ray.init("auto")
          gcs_address = ray.get_runtime_context().gcs_address
  
          # Schedule a pg on nodes
          pg = placement_group(
              [{"CPU": 2}] * 3, strategy="STRICT_SPREAD"
          )
          ray.get(pg.ready())
  
          time.sleep(2)
          remove_placement_group(pg)
  
          from ray.autoscaler.v2.sdk import get_cluster_status
  
          def verify():
              cluster_state = get_cluster_status(gcs_address)
  
              # Verify that nodes are idle.
              assert len((cluster_state.idle_nodes)) == 3
              for node in cluster_state.idle_nodes:
                  assert node.node_status == "IDLE"
                  assert node.resource_usage.idle_time_ms >= 1000
  
              return True
  
          wait_for_condition(verify)
      finally:
          ray.shutdown()
          cluster.shutdown()
  
file_path: ray/python/ray/autoscaler/v2/tests/test_e2e.py
imports: import os
  import sys
  import time
  from typing import Dict
  import pytest
  import ray
  from ray._private.resource_spec import HEAD_NODE_RESOURCE_NAME
  from ray._private.test_utils import run_string_as_driver_nonblocking, wait_for_condition
  from ray.autoscaler.v2.sdk import get_cluster_status
  from ray.cluster_utils import AutoscalingCluster
  from ray.util.placement_group import placement_group, remove_placement_group
  from ray.util.state.api import list_placement_groups, list_tasks
label_desc: Use image node_id 5 for calling a global function with example usage: test_placement_group_removal_idle_node() and returns: True