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

Optimize the implementation of uri & Fix async log bug (#1364)

* Optimize the implementation of uri

* remove redundant func

* Set the right order of _set_client_uri

* Update qlib/workflow/expm.py

* Simplify client & add test.Add docs; Fix async bug

* Fix comments & pylint

* Improve README
This commit is contained in:
you-n-g
2022-11-18 13:11:31 +08:00
committed by GitHub
parent b51e881be3
commit 994f89319d
7 changed files with 94 additions and 63 deletions

View File

@@ -0,0 +1,3 @@
Some implementations of Qlib depend on some assumptions of its dependencies.
So some tests are requried to ensure that these assumptions are valid.

View File

@@ -0,0 +1,34 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
import unittest
import mlflow
import time
from pathlib import Path
import shutil
class MLflowTest(unittest.TestCase):
TMP_PATH = Path("./.mlruns_tmp/")
def tearDown(self) -> None:
if self.TMP_PATH.exists():
shutil.rmtree(self.TMP_PATH)
def test_creating_client(self):
"""
Please refer to qlib/workflow/expm.py:MLflowExpManager._client
we don't cache _client (this is helpful to reduce maintainance work when MLflowExpManager's uri is chagned)
This implementation is based on the assumption creating a client is fast
"""
start = time.time()
for i in range(10):
_ = mlflow.tracking.MlflowClient(tracking_uri=str(self.TMP_PATH))
end = time.time()
elasped = end - start
self.assertLess(elasped, 1e-2) # it can be done in less than 10ms
print(elasped)
if __name__ == "__main__":
unittest.main()