code: def test_worker_shutdown(ray_start_2_cpus):
      assert ray.available_resources()["CPU"] == 2
      wg = WorkerGroup(num_workers=2)
      time.sleep(1)
      assert "CPU" not in ray.available_resources()
      assert len(ray._private.state.actors()) == 2
      wg.shutdown()
      time.sleep(1)
      assert ray.available_resources()["CPU"] == 2
  
      with pytest.raises(RuntimeError):
          wg.execute(lambda: 1)
  
imports: import time
  from collections import defaultdict
  import pytest
  import ray
  import ray._private.ray_constants
  from ray.train._internal.worker_group import Worker, WorkerGroup, WorkerMetadata
label_desc: Use image node_id 6 for calling a global function with example usage: test_worker_shutdown(ray_start_2_cpus) without return types