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:
3
tests/dependency_tests/README.md
Normal file
3
tests/dependency_tests/README.md
Normal 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.
|
||||
34
tests/dependency_tests/test_mlflow.py
Normal file
34
tests/dependency_tests/test_mlflow.py
Normal 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()
|
||||
Reference in New Issue
Block a user