1
0
mirror of https://github.com/microsoft/qlib.git synced 2026-07-12 07:16:54 +08:00

add parallel processor

This commit is contained in:
Young
2020-11-06 10:24:21 +00:00
parent eead71fcb5
commit 9a826eefa3
5 changed files with 58 additions and 14 deletions

View File

@@ -78,10 +78,10 @@ class TimeInspector(object):
Info that will be log into stdout.
"""
cost_time = time() - cls.time_marks.pop()
cls.timer_logger.info("Time cost: {0:.5f} | {1}".format(cost_time, info))
cls.timer_logger.info("Time cost: {0:.3f}s | {1}".format(cost_time, info))
@contextmanager
@classmethod
@contextmanager
def logt(cls, name="", show_start=False):
"""logt.
Log the time of the inside code
@@ -94,13 +94,13 @@ class TimeInspector(object):
show_start
"""
if show_start:
cls.timer_logger.info(f"Begin {name}")
cls.timer_logger.info(f"{name} Begin")
cls.set_time_mark()
try:
yield None
finally:
pass
cls.log_cost_time()
cls.log_cost_time(info=f"{name} Done")
def set_log_with_config(log_config: dict):