From c8211e90ff448f50d529531d9776a6256821f268 Mon Sep 17 00:00:00 2001 From: Mark Aron Szulyovszky Date: Fri, 7 Jan 2022 15:32:18 +0100 Subject: [PATCH] fix(Reporting): raise exception if wandb is not available but `with_wandb` is True (#122) --- reporting/wandb.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/reporting/wandb.py b/reporting/wandb.py index 914aa53..129e389 100644 --- a/reporting/wandb.py +++ b/reporting/wandb.py @@ -5,9 +5,9 @@ from utils.helpers import weighted_average def launch_wandb(project_name:str, default_config:dict, sweep:bool=False): from wandb_setup import get_wandb wandb = get_wandb() - - if wandb is None: - return None + if wandb is None: + raise Exception("Wandb can not be initalized, the environment variable WANDB_API_KEY is missing (can also use .env file)") + elif sweep: wandb.init(project=project_name, config = default_config) return wandb