code: def test_worker_capping_kill_idle_workers(shutdown_only):
      # Avoid starting initial workers by setting num_cpus to 0.
      ray.init(num_cpus=0)
      assert len(get_workers()) == 0
  
      @ray.remote(num_cpus=0)
      class Actor:
          def ping(self):
              pass
  
      actor = Actor.remote()
      ray.get(actor.ping.remote())
      # Actor is now alive and worker 1 which holds the actor is alive
      assert len(get_workers()) == 1
  
      @ray.remote(num_cpus=0)
      def foo():
          # Wait for a while
          time.sleep(10)
  
      obj1 = foo.remote()
      # Worker 2 runs a normal task
      wait_for_condition(lambda: len(get_workers()) == 2)
  
      obj2 = foo.remote()
      # Worker 3 runs a normal task
      wait_for_condition(lambda: len(get_workers()) == 3)
  
      ray.get([obj1, obj2])
      # Worker 2 and 3 now become idle and should be killed
      wait_for_condition(lambda: len(get_workers()) == 1)
  
file_path: ray/python/ray/tests/test_multi_tenancy.py
imports: import os
  import sys
  import time
  import pytest
  import numpy
  import ray
  from ray.core.generated import common_pb2
  from ray.core.generated import node_manager_pb2, node_manager_pb2_grpc
  from ray._private.test_utils import wait_for_condition, run_string_as_driver, run_string_as_driver_nonblocking
  from ray._private.utils import init_grpc_channel
label_desc: Use image node_id 5 for calling a global function with example usage: test_worker_capping_kill_idle_workers(shutdown_only) without return types