code: def check_run(api: Api) -> bool:
      print(
          "Checking logged metrics, saving and downloading a file".ljust(
              72, "."
          ),
          end="",
      )
      failed_test_strings = []
  
      # set up config
      n_epochs = 4
      string_test = "A test config"
      dict_test = {"config_val": 2, "config_string": "config string"}
      list_test = [0, "one", "2"]
      config = {
          "epochs": n_epochs,
          "stringTest": string_test,
          "dictTest": dict_test,
          "listTest": list_test,
      }
      # create a file to save
      filepath = "./test with_special-characters.txt"
      f = open(filepath, "w")
      f.write("test")
      f.close()
  
      with wandb.init(
          id=nice_id("check_run"),
          reinit=True,
          config=config,
          project=PROJECT_NAME,
      ) as run:
          run_id = run.id
          entity = run.entity
          logged = True
          try:
              for i in range(1, 11):
                  run.log({"loss": 1.0 / i}, step=i)
              log_dict = {"val1": 1.0, "val2": 2}
              run.log({"dict": log_dict}, step=i + 1)
          except Exception:
              logged = False
              failed_test_strings.append(
                  "Failed to log values to run. Contact W&B for support."
              )
  
          try:
              run.log(
                  {
                      "HT%3ML ": wandb.Html(
                          '<a href="https://mysite">Link</a>'
                      )
                  }
              )
          except Exception:
              failed_test_strings.append(
                  "Failed to log to media. Contact W&B for support."
              )
  
          wandb.save(filepath)
      public_api = wandb.Api()
      prev_run = public_api.run(f"{entity}/{PROJECT_NAME}/{run_id}")
      # raise Exception(prev_run.__dict__)
      if prev_run is None:
          failed_test_strings.append(
              "Failed to access run through API. Contact W&B for support."
          )
          print_results(failed_test_strings, False)
          return False
      for key, value in prev_run.config.items():
          if config[key] != value:
              failed_test_strings.append(
                  "Read config values don't match run config. Contact W&B for support."
              )
              break
      if logged and (
          prev_run.history_keys["keys"]["loss"]["previousValue"] != 0.1
          or prev_run.history_keys["lastStep"] != 11
          or prev_run.history_keys["keys"]["dict.val1"]["previousValue"]
          != 1.0
          or prev_run.history_keys["keys"]["dict.val2"]["previousValue"]
          != 2
      ):
          failed_test_strings.append(
              "History metrics don't match logged values. Check database encoding."
          )
  
      if logged and prev_run.summary["loss"] != 1.0 / 10:
          failed_test_strings.append(
              "Read summary values don't match expected value. Check database encoding, or contact W&B for support."
          )
      # TODO: (kdg) refactor this so it doesn't rely on an exception handler
      try:
          read_file = retry_fn(partial(prev_run.file, filepath))
          # There's a race where the file hasn't been processed in the queue,
          # we just retry until we get a download
          read_file = retry_fn(
              partial(read_file.download, replace=True)
          )
      except Exception:
          failed_test_strings.append(
              "Unable to download file. Check SQS configuration, topic configuration and bucket permissions."
          )
  
          print_results(failed_test_strings, False)
          return False
      contents = read_file.read()
      if contents != "test":
          failed_test_strings.append(
              "Contents of downloaded file do not match uploaded contents. Contact W&B for support."
          )
      print_results(failed_test_strings, False)
      return len(failed_test_strings) == 0
  
imports: import getpass
  import os
  import time
  from functools import partial
  from pathlib import Path
  from typing import Any, Callable, Dict, List, Optional, Tuple, Union
  import click
  import requests
  from pkg_resources import parse_version
  from wandb_gql import gql
  import wandb
  from wandb.sdk.artifacts.artifact import Artifact
  from wandb.sdk.lib import runid
  from ...apis.internal import Api
label_desc: Use image node_id 7 for calling a global function with example usage: check_run(api) and returns: unknown, False, False