code: def test_head_node_down(short_gcs_publish_timeout, ray_start_cluster):
      """Make sure all ray workers when head node is dead."""
      cluster = ray_start_cluster
      # head node.
      head = cluster.add_node(
          num_cpus=2,
          _system_config={"gcs_rpc_server_reconnect_timeout_s": 1},
      )
  
      # worker nodes.
      num_worker_nodes = 2
      for _ in range(num_worker_nodes):
          cluster.add_node(num_cpus=2)
      cluster.wait_for_nodes()
  
      # Start a driver.
      driver = """
  import ray
  ray.init(address="{}")
  @ray.remote
  def f():
      import time
      time.sleep(10)
  
  num_cpus = int(ray.available_resources()["CPU"])
  tasks = [f.remote() for _ in range(num_cpus)]
  import time
  time.sleep(100)
  """.format(
          cluster.address
      )
  
      p = run_string_as_driver_nonblocking(driver)
      # Make sure the driver is running.
      time.sleep(1)
      wait_for_condition(lambda: p.poll() is None)
      wait_for_condition(
          lambda: len(get_all_ray_worker_processes()) > 0
      )
  
      cluster.remove_node(head)
  
      wait_for_condition(
          lambda: len(get_all_ray_worker_processes()) == 0,
          timeout=WAIT_TIMEOUT,
      )
  
imports: import sys
  import time
  import platform
  import os
  import signal
  import multiprocessing
  import pytest
  import ray
  import psutil
  from ray._private.test_utils import wait_for_condition, run_string_as_driver_nonblocking
  from ray.util.state import get_worker, list_tasks
  from ray.util.scheduling_strategies import PlacementGroupSchedulingStrategy
label_desc: Use image node_id 10 for calling a global function with example usage: test_head_node_down(short_gcs_publish_timeout, ray_start_cluster) without return types