code: def test_kubernetes_agent_on_local_process_sweep():
      run_cap = 4
      try:
          agent_process = run_cmd_async(
              f"wandb launch-agent -q {QUEUE} -e {ENTITY} -c tests/release_tests/test_launch/local-agent-config.yml"
          )
          sweep_config = {
              "job": f"{ENTITY}/{PROJECT}/{JOB_NAME}",
              "project": PROJECT,
              "entity": ENTITY,
              "run_cap": run_cap,
              "method": "bayes",
              "metric": {
                  "name": "avg",
                  "goal": "maximize",
              },
              "parameters": {
                  "param1": {
                      "min": 0,
                      "max": 8,
                  }
              },
          }
  
          yaml.dump(
              sweep_config,
              open("tests/release_tests/test_launch/c.yaml", "w"),
          )
  
          proc = run_cmd_async(
              f"wandb launch-sweep tests/release_tests/test_launch/c.yaml -e {ENTITY} -p {PROJECT} -q {QUEUE}"
          )
  
          # Poll process.stdout to show stdout live
          sweep_id = get_sweep_id_from_proc(proc)
          assert sweep_id
  
          # poll on sweep scheduler run
          run = wait_for_run_completion(
              f"{ENTITY}/{PROJECT}/{sweep_id}"
          )
          assert run
  
          api = Api()
          sweep: Sweep = api.sweep(f"{ENTITY}/{PROJECT}/{sweep_id}")
          sweep.load(force=True)
  
          assert len(sweep.runs) == run_cap
          for run in sweep.runs:
              assert run.config["param1"] in list(range(0, 8 + 1))
              assert run.state == "finished"
  
              summary = run.summary
              history = run.history(pandas=False)
  
              assert summary["time_elapsed"]
              assert summary["avg"]
              assert len(history) == 50
              assert history[-1]["steps"] == 49
  
      finally:
          agent_process.kill()
          proc.kill()
  
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 3 for calling a global function with example usage: test_kubernetes_agent_on_local_process_sweep() without return types