code: def start_killing_nodes(duration, kill_interval, kill_node_type):
      """Kill the nodes in ray cluster.
  
      duration: How long does we run the test (seconds)
      kill_interval: The interval between two kills (seconds)
      kill_head_every_n: For every n kills, we kill a head node
      kill_node_type: kill either worker node or head node
      """
  
      for kill_idx in range(1, int(duration / kill_interval)):
          while True:
              try:
                  # kill
                  if kill_node_type == TestScenario.KILL_HEAD_NODE:
                      kill_head()
                  elif kill_node_type == TestScenario.KILL_WORKER_NODE:
                      kill_worker()
                  break
              except Exception as e:
                  from time import sleep
  
                  print(f"Fail to kill node, retry in 5 seconds: {e}")
                  sleep(5)
  
          time.sleep(kill_interval)
  
imports: import enum
  import json
  import subprocess
  from kubernetes import client, config, watch
  import requests
  import random
  import uuid
  import pathlib
  import time
  import ray
  import os
label_desc: Use image node_id 10 for calling a global function with example usage: start_killing_nodes(duration, kill_interval, kill_node_type) without return types