mirror of
https://github.com/microsoft/qlib.git
synced 2026-07-10 06:20:57 +08:00
safe remove file and more friendly log (#967)
* save remove file and more friendly log * fix pylint
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
# Licensed under the MIT License.
|
||||
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
from typing import Union
|
||||
from sklearn.decomposition import PCA, FactorAnalysis
|
||||
|
||||
|
||||
@@ -351,14 +351,16 @@ class MLflowRecorder(Recorder):
|
||||
path = self.client.download_artifacts(self.id, name)
|
||||
with Path(path).open("rb") as f:
|
||||
data = unpickler(f).load()
|
||||
return data
|
||||
except Exception as e:
|
||||
logger.exception(f"Fail to load data '{name}'")
|
||||
raise LoadObjectError(str(e)) from e
|
||||
finally:
|
||||
ar = self.client._tracking_client._get_artifact_repo(self.id)
|
||||
if isinstance(ar, AzureBlobArtifactRepository):
|
||||
# for saving disk space
|
||||
# For safety, only remove redundant file for specific ArtifactRepository
|
||||
shutil.rmtree(Path(path).absolute().parent)
|
||||
return data
|
||||
except Exception as e:
|
||||
raise LoadObjectError(str(e)) from e
|
||||
|
||||
@AsyncCaller.async_dec(ac_attr="async_log")
|
||||
def log_params(self, **kwargs):
|
||||
|
||||
Reference in New Issue
Block a user