1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-07-17 01:14:35 +08:00

Fix exp uri CI bug

This commit is contained in:
Young
2022-01-10 17:29:27 +08:00
parent 0304df0d5b
commit 19689024d4
2 changed files with 7 additions and 4 deletions

View File

@@ -8,6 +8,7 @@ from .exp import Experiment
from .recorder import Recorder from .recorder import Recorder
from ..utils import Wrapper from ..utils import Wrapper
from ..utils.exceptions import RecorderInitializationError from ..utils.exceptions import RecorderInitializationError
from qlib.config import C
class QlibRecorder: class QlibRecorder:
@@ -351,7 +352,7 @@ class QlibRecorder:
@contextmanager @contextmanager
def uri_context(self, uri: Text): def uri_context(self, uri: Text):
""" """
Temporarily set the exp_manager's uri to uri Temporarily set the exp_manager's **default_uri** to uri
NOTE: NOTE:
- Please refer to the NOTE in the `set_uri` - Please refer to the NOTE in the `set_uri`
@@ -361,12 +362,12 @@ class QlibRecorder:
uri : Text uri : Text
the temporal uri the temporal uri
""" """
prev_uri = self.exp_manager._current_uri prev_uri = self.exp_manager.default_uri
self.exp_manager.set_uri(uri) C.exp_manager["kwargs"]["uri"] = uri
try: try:
yield yield
finally: finally:
self.exp_manager.set_uri(prev_uri) C.exp_manager["kwargs"]["uri"] = prev_uri
def get_recorder( def get_recorder(
self, self,

View File

@@ -353,6 +353,8 @@ class MLflowExpManager(ExpManager):
if self.active_experiment is not None: if self.active_experiment is not None:
self.active_experiment.end(recorder_status) self.active_experiment.end(recorder_status)
self.active_experiment = None self.active_experiment = None
# When an experiment end, we will release the current uri.
self._current_uri = None
def create_exp(self, experiment_name: Optional[Text] = None): def create_exp(self, experiment_name: Optional[Text] = None):
assert experiment_name is not None assert experiment_name is not None