mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2026-04-22 16:07:51 +08:00
[log]console log to llm log (#5680)
This commit is contained in:
@@ -18,7 +18,7 @@ import os
|
||||
import shutil
|
||||
import uuid
|
||||
|
||||
from fastdeploy.utils import console_logger
|
||||
from fastdeploy.utils import llm_logger
|
||||
|
||||
|
||||
def setup_multiprocess_prometheus():
|
||||
@@ -33,12 +33,12 @@ def setup_multiprocess_prometheus():
|
||||
if os.path.exists(prom_dir):
|
||||
shutil.rmtree(prom_dir, ignore_errors=True)
|
||||
os.makedirs(prom_dir, exist_ok=True)
|
||||
console_logger.info(f"PROMETHEUS_MULTIPROC_DIR is set to be {prom_dir}")
|
||||
llm_logger.info(f"PROMETHEUS_MULTIPROC_DIR is set to be {prom_dir}")
|
||||
os.environ["PROMETHEUS_MULTIPROC_DIR"] = prom_dir
|
||||
return prom_dir
|
||||
else:
|
||||
prom_dir = os.environ["PROMETHEUS_MULTIPROC_DIR"]
|
||||
console_logger.warning(
|
||||
llm_logger.warning(
|
||||
f"Found PROMETHEUS_MULTIPROC_DIR:{prom_dir} was set by user. "
|
||||
"you will find inaccurate metrics. Unset the variable "
|
||||
"will properly handle cleanup."
|
||||
|
||||
@@ -37,7 +37,7 @@ class TestSetupMultiprocessPrometheus:
|
||||
|
||||
with (
|
||||
patch("uuid.uuid4", return_value="test-uuid"),
|
||||
patch("fastdeploy.utils.console_logger.info") as mock_logger,
|
||||
patch("fastdeploy.utils.llm_logger.info") as mock_logger,
|
||||
):
|
||||
|
||||
result = setup_multiprocess_prometheus()
|
||||
@@ -51,7 +51,7 @@ class TestSetupMultiprocessPrometheus:
|
||||
test_dir = "/tmp/existing_dir"
|
||||
os.environ["PROMETHEUS_MULTIPROC_DIR"] = test_dir
|
||||
|
||||
with patch("fastdeploy.utils.console_logger.warning") as mock_logger:
|
||||
with patch("fastdeploy.utils.llm_logger.warning") as mock_logger:
|
||||
result = setup_multiprocess_prometheus()
|
||||
|
||||
assert result == test_dir
|
||||
@@ -69,7 +69,7 @@ class TestSetupMultiprocessPrometheus:
|
||||
with (
|
||||
patch("os.path.exists", return_value=True),
|
||||
patch("uuid.uuid4", return_value="test-uuid"),
|
||||
patch("fastdeploy.utils.console_logger.info") as mock_logger,
|
||||
patch("fastdeploy.utils.llm_logger.info") as mock_logger,
|
||||
):
|
||||
|
||||
# 模拟 rmtree 但确保 ignore_errors=True 生效
|
||||
|
||||
Reference in New Issue
Block a user