def _get_wandb_key(self) -> str:
    """Takes a config and loads the wandb key."""

    if os.getenv("WANDB_API_KEY"):
      return os.getenv("WANDB_API_KEY", "")

    key_path = f"/var/lib/tss/keys/{getpass.getuser()}/onpremwandb.key"

    with open(key_path, "r") as key_file:
      wandb_key = key_file.read().strip()

    return wandb_key
Takes a config and loads the wandb key.
sourcecode/scoring/matrix_factorization/wandb_utils.py