code: def test_request_cancel_resources(ray_start_4_cpus):
      """Test that canceling a resource request clears the PG futures.
  
      - Create request
      - Assert actual PG is created
      - Cancel request
      - Assert staging future is removed
      - Assert actual PG is removed
      """
      manager = PlacementGroupResourceManager(update_interval_s=0)
      assert not manager.has_resources_ready(REQUEST_2_CPU)
  
      manager.request_resources(REQUEST_2_CPU)
  
      # Could be pending or created
      pg_states = _count_pg_states()
      assert pg_states["PENDING"] + pg_states["CREATED"] == 1
      assert pg_states["REMOVED"] == 0
  
      assert manager.get_resource_futures()
  
      manager.cancel_resource_request(REQUEST_2_CPU)
  
      assert not manager.get_resource_futures()
  
      pg_states = _count_pg_states()
      assert pg_states["PENDING"] + pg_states["CREATED"] == 0
      assert pg_states["REMOVED"] == 1
  
file_path: ray/python/ray/air/tests/execution/test_resource_manager_placement_group.py
imports: import time
  from collections import Counter
  import pytest
  import ray
  from ray.air.execution.resources.placement_group import PlacementGroupResourceManager
  from ray.air.execution.resources.request import ResourceRequest
label_desc: Use image node_id 3 for calling a global function with example usage: test_request_cancel_resources(ray_start_4_cpus) without return types