Skip to content

Commit

Permalink
Set _artifact_uri when mlflow_run is not None. (#1367)
Browse files Browse the repository at this point in the history
* Set _artifact_uri when mlflow_run is not None.

* Fix black.
  • Loading branch information
ChiahungTai authored Nov 19, 2022
1 parent e47b0f1 commit 0c4db8b
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions qlib/workflow/recorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ def __init__(self, experiment_id, uri, name=None, mlflow_run=None):
if mlflow_run.info.end_time is not None
else None
)
self._artifact_uri = mlflow_run.info.artifact_uri
self.async_log = None

def __repr__(self):
Expand Down
29 changes: 29 additions & 0 deletions tests/test_workflow.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import unittest
from pathlib import Path
import shutil

from qlib.workflow import R
from qlib.tests import TestAutoData


class WorkflowTest(TestAutoData):
TMP_PATH = Path("./.mlruns_tmp/")

def tearDown(self) -> None:
if self.TMP_PATH.exists():
shutil.rmtree(self.TMP_PATH)

def test_get_local_dir(self):
""" """
with R.start(uri=str(self.TMP_PATH)):
pass

with R.uri_context(uri=str(self.TMP_PATH)):
resume_recorder = R.get_recorder()
resume_recorder.get_local_dir()


if __name__ == "__main__":
unittest.main()

0 comments on commit 0c4db8b

Please sign in to comment.