code: def wait_for_run_completion(path: str) -> "wandb.Run":
      api = Api()
      tries = 0
      run = None
      while not (run and run.state == "finished") and tries < 8:
          # Sometimes takes a bit for the run's completion to populate in W&B
          try:
              run = api.run(path=path)
              run.load(force=True)
          except wandb.errors.CommError:
              pass
          sleep(2**tries)
          tries += 1
      return run
  
file_path: wandb/tests/release_tests/test_launch/utils.py
imports: import signal
  import subprocess
  import sys
  from time import sleep
  from typing import Optional
  import wandb
  import yaml
  from kubernetes import client, config, watch
  from wandb.apis.public import Api
label_desc: Use image node_id 6 for calling a global function with example usage: wait_for_run_completion(path) and returns: run