Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
fe0195ee
S
Serving
项目概览
PaddlePaddle
/
Serving
1 年多 前同步成功
通知
186
Star
833
Fork
253
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
105
列表
看板
标记
里程碑
合并请求
10
Wiki
2
Wiki
分析
仓库
DevOps
项目成员
Pages
S
Serving
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
105
Issue
105
列表
看板
标记
里程碑
合并请求
10
合并请求
10
Pages
分析
分析
仓库分析
DevOps
Wiki
2
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
fe0195ee
编写于
1月 14, 2022
作者:
F
felixhjh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
split log with different test cases
上级
680e2f14
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
33 addition
and
10 deletion
+33
-10
python/paddle_serving_server/env_check/run.py
python/paddle_serving_server/env_check/run.py
+16
-0
python/paddle_serving_server/env_check/util.py
python/paddle_serving_server/env_check/util.py
+9
-6
python/paddle_serving_server/serve.py
python/paddle_serving_server/serve.py
+8
-4
未找到文件。
python/paddle_serving_server/env_check/run.py
浏览文件 @
fe0195ee
...
...
@@ -30,12 +30,24 @@ import pytest
inference_test_cases
=
[
"test_fit_a_line.py::TestFitALine::test_inference"
]
cpp_test_cases
=
[
"test_fit_a_line.py::TestFitALine::test_cpu"
,
"test_fit_a_line.py::TestFitALine::test_gpu"
]
pipeline_test_cases
=
[
"test_uci_pipeline.py::TestUCIPipeline::test_cpu"
,
"test_uci_pipeline.py::TestUCIPipeline::test_gpu"
]
log_files
=
[
"PipelineServingLogs"
,
"log"
,
"stderr.log"
,
"stdout.log"
]
def
set_serving_log_path
():
if
'SERVING_LOG_PATH'
not
in
os
.
environ
:
serving_log_path
=
os
.
path
.
expanduser
(
os
.
getcwd
())
os
.
environ
[
'SERVING_LOG_PATH'
]
=
serving_log_path
def
mv_log_to_new_dir
(
dir_path
):
import
shutil
if
not
os
.
path
.
exists
(
dir_path
):
os
.
mkdir
(
dir_path
)
serving_log_path
=
os
.
environ
[
'SERVING_LOG_PATH'
]
for
file_name
in
log_files
:
file_path
=
os
.
path
.
join
(
serving_log_path
,
file_name
)
if
os
.
path
.
exists
(
file_path
):
shutil
.
move
(
file_path
,
dir_path
)
def
run_test_cases
(
cases_list
,
case_type
,
is_open_std
):
old_stdout
,
old_stderr
=
sys
.
stdout
,
sys
.
stderr
real_path
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
...
...
@@ -48,6 +60,10 @@ def run_test_cases(cases_list, case_type, is_open_std):
res
=
pytest
.
main
(
args
)
sys
.
stdout
,
sys
.
stderr
=
old_stdout
,
old_stderr
case_name
=
case
.
split
(
'_'
)[
-
1
]
serving_log_path
=
os
.
environ
[
'SERVING_LOG_PATH'
]
dir_name
=
str
(
case_type
)
+
'_'
+
case
.
split
(
':'
)[
-
1
]
new_dir_path
=
os
.
path
.
join
(
serving_log_path
,
dir_name
)
mv_log_to_new_dir
(
new_dir_path
)
if
res
==
0
:
print
(
"{} {} environment running success"
.
format
(
case_type
,
case_name
))
elif
res
==
1
:
...
...
python/paddle_serving_server/env_check/util.py
浏览文件 @
fe0195ee
...
...
@@ -13,6 +13,7 @@ class ServingTest(object):
DATA_PATH: 数据集根目录
py_version: python版本 python3.6~3.8
"""
self
.
serving_log_path
=
os
.
environ
[
'SERVING_LOG_PATH'
]
code_path
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
self
.
data_path
=
f
"
{
code_path
}
/
{
data_path
}
/"
self
.
example_path
=
f
"
{
code_path
}
/
{
example_path
}
/"
...
...
@@ -37,6 +38,9 @@ class ServingTest(object):
os
.
system
(
f
"ln -s
{
abs_path
}
{
file
}
"
)
def
start_server_by_shell
(
self
,
cmd
:
str
,
sleep
:
int
=
5
,
err
=
"stderr.log"
,
out
=
"stdout.log"
,
wait
=
False
):
err
=
os
.
path
.
join
(
self
.
serving_log_path
,
err
)
out
=
os
.
path
.
join
(
self
.
serving_log_path
,
out
)
self
.
err
=
open
(
err
,
"w"
)
self
.
out
=
open
(
out
,
"w"
)
p
=
subprocess
.
Popen
(
cmd
,
shell
=
True
,
stdout
=
self
.
out
,
stderr
=
self
.
err
)
...
...
@@ -128,17 +132,16 @@ def diff_compare(array1, array2):
def
print_log
(
file_list
,
iden
=
""
):
serving_log_path
=
os
.
environ
[
'SERVING_LOG_PATH'
]
for
file
in
file_list
:
print
(
f
"======================
{
file
}
{
iden
}
====================="
)
if
os
.
path
.
exists
(
file
):
with
open
(
file
,
"r"
)
as
f
:
print
(
f
"======================
{
file
}
====================="
)
file_path
=
os
.
path
.
join
(
serving_log_path
,
file
)
if
os
.
path
.
exists
(
file_path
):
with
open
(
file_path
,
"r"
)
as
f
:
print
(
f
.
read
())
if
file
.
startswith
(
"log"
)
or
file
.
startswith
(
"PipelineServingLogs"
):
os
.
remove
(
file
)
else
:
pass
def
parse_prototxt
(
file
):
with
open
(
file
,
"r"
)
as
f
:
lines
=
[
i
.
strip
().
split
(
":"
)
for
i
in
f
.
readlines
()]
...
...
python/paddle_serving_server/serve.py
浏览文件 @
fe0195ee
...
...
@@ -480,10 +480,14 @@ class Check_Env_Shell(cmd.Cmd):
# ----- basic commands -----
def
do_help
(
self
,
arg
):
print
(
"
\n
Command list
\t\t
Description
\n
"
\
"check_all
\t\t
Check Environment of Paddle Inference, Pipeline Serving, C++ Serving
\n
"
\
"check_pipeline
\t\t
Check Environment of Pipeline Serving
\n
"
\
"check_cpp
\t\t
Check Environment of C++ Serving
\n
"
\
"check_inference
\t\t
Check Environment of Paddle Inference
\n
"
\
"check_all
\t\t
Check Environment of Paddle Inference, Pipeline Serving, C++ Serving. "
\
"If failed, using debug command to debug
\n
"
\
"check_pipeline
\t\t
Check Environment of Pipeline Serving. "
\
"If failed, using debug command to debug
\n
"
\
"check_cpp
\t\t
Check Environment of C++ Serving. "
\
"If failed, using debug command to debug
\n
"
\
"check_inference
\t\t
Check Environment of Paddle Inference. "
\
"If failed, using debug command to debug
\n
"
\
"debug
\t\t\t
When checking was failed, open log to debug
\n
"
\
"exit
\t\t\t
Exit Check Env Shell
\n
"
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录