code: def test_kubernetes_agent_in_cluster(
      api_key: str, agent_image: Optional[str]
  ):
      init_agent_in_launch_cluster(NAMESPACE, api_key, agent_image)
      try:
          # Start run
          queued_run = launch_add(
              job=f"{ENTITY}/{PROJECT}/{JOB_NAME}",
              queue_name=QUEUE,
              entity=ENTITY,
              config=LAUNCH_JOB_CONFIG,
          )
  
          status = wait_for_k8s_job_completion(
              NAMESPACE, ENTITY, PROJECT, 1
          )
          completed_run = wait_for_queued_image_job_completion(
              ENTITY, PROJECT, queued_run
          )
  
          summary = completed_run.summary
          history = completed_run.history(pandas=False)
  
          assert (
              status == "Succeeded"
          ), "Kubernetes job didn't succeed. Check Kubernetes pods and Docker container output."
          assert summary["time_elapsed"]
          assert summary["avg"]
          assert len(history) == 50
          assert history[-1]["steps"] == 49
  
      finally:
          # Cleanup
          cleanup_deployment(NAMESPACE)
  
file_path: wandb/tests/release_tests/test_launch/test_kubernetes.py
imports: from typing import Optional
  import pytest
  import yaml
  from utils import cleanup_deployment, get_sweep_id_from_proc, init_agent_in_launch_cluster, run_cmd, run_cmd_async, wait_for_k8s_job_completion, wait_for_queued_image_job_completion, wait_for_run_completion
  from wandb.apis.public import Api, Sweep
  from wandb.sdk.launch._launch_add import launch_add
label_desc: Use image node_id 2 for calling a global function with example usage: test_kubernetes_agent_in_cluster(api_key, agent_image) without return types