code: def test_demands_when_driver_exits(call_ray_start):
      script = f"""
  import ray
  ray.init(address='{call_ray_start}')
  
  import os
  import time
  @ray.remote(num_cpus=3)
  def use_gpu():
      time.sleep(1)
  
  @ray.remote(num_gpus=10)
  class A:
      pass
  
  A.options(name="a", lifetime="detached").remote()
  
  print(ray.get([use_gpu.remote(), use_gpu.remote()]))
  """
  
      proc = run_string_as_driver_nonblocking(script)
      gcs_cli = ray._raylet.GcsClient(address=f"{call_ray_start}")
  
      def check_demands(n):
          status = gcs_cli.internal_kv_get(
              ray._private.ray_constants.DEBUG_AUTOSCALING_STATUS.encode(),
              namespace=None,
          )
          import json
  
          status = json.loads(status.decode())
          return (
              len(status["load_metrics_report"]["resource_demand"]) == n
          )
  
      wait_for_condition(lambda: check_demands(2))
      proc.terminate()
      wait_for_condition(lambda: check_demands(1))
  
imports: import os
  import sys
  import time
  import pytest
  import ray
  import ray._private.ray_constants
  from ray._private.test_utils import Semaphore, enable_external_redis, client_test_enabled, run_string_as_driver, wait_for_condition, get_gcs_memory_used, run_string_as_driver_nonblocking
  from ray.experimental.internal_kv import _internal_kv_list
  from ray.tests.conftest import call_ray_start
  import subprocess
  import psutil
label_desc: Use image node_id 11 for calling a global function with example usage: test_demands_when_driver_exits(call_ray_start) and returns: unknown