code: def test_launch_sweep_param_validation(
      user, wandb_init, test_settings
  ):
      # make a job artifact for testing
      _project = "test-project7"
      settings = test_settings({"project": _project})
      run = wandb_init(settings=settings)
      job_artifact = run._log_job_artifact_with_image(
          "ljadnfakehbbr:latest", args=[]
      )
      job_name = f"{user}/{_project}/{job_artifact.wait().name}"
      run.finish()
  
      base = ["wandb", "launch-sweep"]
      _run_cmd_check_msg(base, "Usage: wandb launch-sweep [OPTIONS]")
  
      base += ["-e", user, "-p", "p"]
      err_msg = "'config' and/or 'resume_id' required"
      _run_cmd_check_msg(base + ["-q", "q"], err_msg)
  
      err_msg = "Could not find sweep"
      with pytest.raises(subprocess.CalledProcessError):
          _run_cmd_check_msg(base + ["-r", "id", "-q", "q"], err_msg)
  
      config = {
          "method": "grid",
          "parameters": {"parameter1": {"values": [1, 2, 3]}},
          "launch": {"queue": "q"},
      }
      json.dump(config, open("s.yaml", "w"))
  
      err_msg = "No 'job' nor 'image_uri' top-level key found in sweep config, exactly one is required for a launch-sweep"
      _run_cmd_check_msg(base + ["s.yaml"], err_msg)
  
      del config["launch"]["queue"]
      config["job"] = job_name
      json.dump(config, open("s.yaml", "w"))
  
      err_msg = "Launch-sweeps require setting a 'queue', use --queue option or a 'queue' key in the 'launch' section in the config"
      _run_cmd_check_msg(base + ["s.yaml", "-e", "e"], err_msg)
  
      base += ["-q", "q"]
  
      config["image_uri"] = "fake-image:latest"
      json.dump(config, open("s.yaml", "w"))
  
      err_msg = "Sweep config has both 'job' and 'image_uri' but a launch-sweep can use only one"
      _run_cmd_check_msg(base + ["s.yaml"], err_msg)
  
      del config["job"]
      json.dump(config, open("s.yaml", "w"))
  
      # this tries to upsert into a non-existent project, because no error
      with pytest.raises(subprocess.CalledProcessError):
          _run_cmd_check_msg(base + ["s.yaml"], "")
  
      with pytest.raises(subprocess.CalledProcessError):
          _run_cmd_check_msg(
              base + ["s123.yaml"], "Invalid value for '[CONFIG]'"
          )
  
file_path: wandb/tests/pytest_tests/system_tests/test_launch/test_launch_sweep_cli.py
imports: import json
  import subprocess
  from typing import List
  import pytest
  import wandb
  from wandb.apis.internal import InternalApi
  from wandb.apis.public import Api
  from wandb.sdk.launch.utils import LAUNCH_DEFAULT_PROJECT
label_desc: Use image node_id 2 for calling a global function with example usage: test_launch_sweep_param_validation(user, wandb_init, test_settings) without return types