From e5e402197a423ebc058bcd5a4329999475b553ed Mon Sep 17 00:00:00 2001 From: Young Date: Tue, 24 Nov 2020 09:18:30 +0000 Subject: [PATCH] delay the creating of `mlruns` folder --- qlib/workflow/expm.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/qlib/workflow/expm.py b/qlib/workflow/expm.py index e1469746a..7af661a64 100644 --- a/qlib/workflow/expm.py +++ b/qlib/workflow/expm.py @@ -225,7 +225,13 @@ class MLflowExpManager(ExpManager): def __init__(self, uri, default_exp_name): super(MLflowExpManager, self).__init__(uri, default_exp_name) - self.client = mlflow.tracking.MlflowClient(tracking_uri=self.uri) + + @property + def client(self): + # Delay the creation of mlflow client in case of creating `mlruns` folder when importing qlib + if not hasattr(self, "_client"): + self._client = mlflow.tracking.MlflowClient(tracking_uri=self.uri) + return self._client def start_exp(self, experiment_name=None, recorder_name=None, uri=None): # create experiment