forked from microsoft/qlib
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize the implementation of uri & Fix async log bug (microsoft#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
- Loading branch information
Showing
7 changed files
with
94 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |