code: def kill_agent_on_update_job(monkeypatch):
      def patched_update_finished(self, job_id):
          if self._jobs[job_id].get_status().state in [
              "failed",
              "finished",
          ]:
              self.finish_job_id(job_id)
              if self._running == 0:
                  # only 1 run in test so kill after it's done
                  raise KeyboardInterrupt
  
      monkeypatch.setattr(
          "wandb.sdk.launch.agent.LaunchAgent._update_finished",
          lambda c, job_id: patched_update_finished(c, job_id),
      )
  
imports: import json
  import os
  from unittest.mock import Mock
  import pytest
  import wandb
  from wandb.apis import public
  from wandb.cli import cli
  from .test_launch import mock_load_backend, mocked_fetchable_git_repo
label_desc: Use image node_id 3 for calling a global function with example usage: kill_agent_on_update_job(monkeypatch) without return types