diff --git a/qlib/workflow/__init__.py b/qlib/workflow/__init__.py index 3898dfd35..91880b281 100644 --- a/qlib/workflow/__init__.py +++ b/qlib/workflow/__init__.py @@ -17,7 +17,7 @@ class QlibRecorder: @contextmanager def start(self, experiment_name): - run = self.start_exp(experiment_name, self.uri) + run = self.start_exp(experiment_name) try: yield run except: diff --git a/qlib/workflow/exp.py b/qlib/workflow/exp.py index 672a77d93..9b5517471 100644 --- a/qlib/workflow/exp.py +++ b/qlib/workflow/exp.py @@ -74,7 +74,7 @@ class MLflowExperiment(Experiment): def create_recorder(self): recorder = MLflowRecorder(self.id) self.recorders.append(recorder) - return recorders + return recorder def search_records(self, **kwargs): filter_string = "" if kwargs.get("filter_string") is None else kwargs.get("filter_string") diff --git a/qlib/workflow/expm.py b/qlib/workflow/expm.py index 0f27c200e..d5c0c247e 100644 --- a/qlib/workflow/expm.py +++ b/qlib/workflow/expm.py @@ -9,7 +9,7 @@ from .exp import MLflowExperiment from .recorder import MLflowRecorder from ..log import get_module_logger -logger = get_module_logger("workflow", "WARN") +logger = get_module_logger("workflow", "WARNING") class ExpManager: @@ -168,8 +168,9 @@ class MLflowExpManager(ExpManager): return self.active_recorder.start_run(experiment_id=experiment.id) def end_exp(self): - self.active_recorder.end_run() - self.active_recorder = None + if self.active_recorder is not None: + self.active_recorder.end_run() + self.active_recorder = None def __create_exp(self, experiment_name=None, uri=None): # init experiment