code: def wait_for_raycluster_crd(tries=60, backoff_s=5):
      """CRD creation can take a bit of time after the client request.
      This function waits until the crd with the provided name is registered.
      """
      switch_to_ray_parent_dir()
      logger.info("Making sure RayCluster CRD has been registered.")
      for i in range(tries):
          get_crd_output = subprocess.check_output(
              ["kubectl", "get", "crd"]
          ).decode()
          if RAYCLUSTERS_QUALIFIED in get_crd_output:
              logger.info("Confirmed existence of RayCluster CRD.")
              break
          elif i < tries - 1:
              logger.info("Still waiting to register RayCluster CRD.")
              time.sleep(backoff_s)
          else:
              raise Exception("Failed to register RayCluster CRD.")
  
      # Create a test RayCluster CR to make sure that the CRD is fully registered.
      for i in range(tries):
          try:
              subprocess.check_call(
                  ["kubectl", "apply", "-f", TEST_CR_PATH]
              )
              break
          except subprocess.CalledProcessError as e:
              logger.info("Can't create RayCluster CR.")
              if i < tries - 1:
                  logger.info("Retrying.")
                  time.sleep(backoff_s)
              else:
                  logger.info("Giving up.")
                  raise e from None
  
      # Confirm the test RayCluster exists.
      out = subprocess.check_output(
          ["kubectl", "get", RAYCLUSTERS_QUALIFIED]
      ).decode()
      assert TEST_CLUSTER_NAME in out, out
  
      # Delete the test RayCluster.
      subprocess.check_call(["kubectl", "delete", "-f", TEST_CR_PATH])
      # Make sure the associated resources are gone before proceeding.
      wait_for_pods(goal_num_pods=0, namespace="default")
  
imports: import atexit
  import contextlib
  import logging
  import pathlib
  import subprocess
  import tempfile
  import time
  from typing import Any, Dict, Generator, List, Optional
  import yaml
  import os
  import ray
  from ray.job_submission import JobStatus, JobSubmissionClient
label_desc: Use image node_id 4 for calling a global function with example usage: wait_for_raycluster_crd(tries, backoff_s) without return types