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

Fix logging_level: make logging level specified in qlib.init applies to all loggers (#1368)

* fix logging_level: make logging level specified in qlib.init apply to all loggers

* downgrade loglevel in expmanager __init__ to debug (it will be called in each process in multiprocessing operations such as read data)

* correct gramma error

* fix black lint

* use functor to cache loggers and set level

* correct black lint

* correct pylint

* correct pylint
This commit is contained in:
YQ Tsui
2022-11-29 08:09:22 +08:00
committed by GitHub
parent 4f5ae4d224
commit 6a47416a2d
7 changed files with 42 additions and 34 deletions

View File

@@ -4,13 +4,12 @@
from typing import Dict, List, Union
from qlib.typehint import Literal
import mlflow
import logging
from mlflow.entities import ViewType
from mlflow.exceptions import MlflowException
from .recorder import Recorder, MLflowRecorder
from ..log import get_module_logger
logger = get_module_logger("workflow", logging.INFO)
logger = get_module_logger("workflow")
class Experiment:
@@ -22,7 +21,7 @@ class Experiment:
def __init__(self, id, name):
self.id = id
self.name = name
self.active_recorder = None # only one recorder can running each time
self.active_recorder = None # only one recorder can run each time
self._default_rec_name = "abstract_recorder"
def __repr__(self):
@@ -232,7 +231,7 @@ class Experiment:
Returns
-------
The return type depent on `rtype`
The return type depends on `rtype`
if `rtype` == "dict":
A dictionary (id -> recorder) of recorder information that being stored.
elif `rtype` == "list":
@@ -354,7 +353,7 @@ class MLflowExperiment(Experiment):
Parameters
----------
max_results : int
the number limitation of the results
the number limitation of the results'
status : str
the criteria based on status to filter results.
`None` indicates no filtering.

View File

@@ -37,7 +37,7 @@ class ExpManager:
self._active_exp_uri = None # No active experiments. So it is set to None
self._default_exp_name = default_exp_name
self.active_experiment = None # only one experiment can be active each time
logger.info(f"experiment manager uri is at {self.uri}")
logger.debug(f"experiment manager uri is at {self.uri}")
def __repr__(self):
return "{name}(uri={uri})".format(name=self.__class__.__name__, uri=self.uri)

View File

@@ -5,7 +5,6 @@ import os
import sys
from typing import Optional
import mlflow
import logging
import shutil
import pickle
import tempfile
@@ -20,7 +19,7 @@ from qlib.utils.paral import AsyncCaller
from ..log import TimeInspector, get_module_logger
from mlflow.store.artifact.azure_blob_artifact_repo import AzureBlobArtifactRepository
logger = get_module_logger("workflow", logging.INFO)
logger = get_module_logger("workflow")
# mlflow limits the length of log_param to 500, but this caused errors when using qrun, so we extended the mlflow limit.
mlflow.utils.validation.MAX_PARAM_VAL_LENGTH = 1000