code: def test_launch_agent_launch_error_continue(
      runner, monkeypatch, user, test_settings
  ):
      async def pop_from_run_queue(self, queue):
          return {
              "runSpec": {"job": "fake-job:latest"},
              "runQueueItemId": "fakerqi",
          }
  
      _setup_agent(monkeypatch, pop_from_run_queue)
  
      def print_then_exit():
          print("except caught, failed item")
          raise KeyboardInterrupt
  
      monkeypatch.setattr(
          "wandb.sdk.launch.agent.LaunchAgent.fail_run_queue_item",
          lambda c, run_queue_item_id, message, phase, files: print_then_exit(),
      )
      monkeypatch.setattr(
          "wandb.sdk.launch.agent.LaunchAgent.run_job",
          lambda a, b, c, d: raise_(LaunchError("blah blah")),
      )
  
      monkeypatch.setattr(
          "wandb.sdk.internal.internal_api.Api.get_launch_agent",
          lambda c, i, g: {
              "id": "mock_agent_id",
              "name": "blah",
              "stopPolling": False,
          },
      )
  
      monkeypatch.setattr(
          "wandb.sdk.internal.internal_api.Api.update_launch_agent_status",
          lambda c, i, s, g: {"success": True},
      )
  
      with runner.isolated_filesystem():
          result = runner.invoke(
              cli.launch_agent,
              [
                  "--entity",
                  user,
                  "--queue",
                  "default",
              ],
          )
          print(result.output)
          assert "blah blah" in result.output
          assert "except caught, failed item" in result.output
  
imports: import json
  from unittest.mock import Mock
  import pytest
  import wandb
  from wandb.cli import cli
  from wandb.sdk.launch.errors import LaunchError
label_desc: Use image node_id 11 for calling a global function with example usage: test_launch_agent_launch_error_continue(runner, monkeypatch, user, test_settings) and returns: dict