Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
011ea89a
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看板
提交
011ea89a
编写于
1月 05, 2022
作者:
F
felixhjh
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add interaction env_check cmd
上级
d97761f3
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
48 addition
and
9 deletion
+48
-9
python/paddle_serving_server/env_check/run.py
python/paddle_serving_server/env_check/run.py
+17
-7
python/paddle_serving_server/serve.py
python/paddle_serving_server/serve.py
+31
-2
未找到文件。
python/paddle_serving_server/env_check/run.py
浏览文件 @
011ea89a
...
...
@@ -31,12 +31,13 @@ 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"
]
def
run_test_cases
(
cases_list
,
case_type
):
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__
))
for
case
in
cases_list
:
sys
.
stdout
=
open
(
'/dev/null'
,
'w'
)
sys
.
stderr
=
open
(
'/dev/null'
,
'w'
)
if
is_open_std
is
False
:
sys
.
stdout
=
open
(
'/dev/null'
,
'w'
)
sys
.
stderr
=
open
(
'/dev/null'
,
'w'
)
args_str
=
"--disable-warnings "
+
str
(
real_path
)
+
"/"
+
case
args
=
args_str
.
split
(
" "
)
res
=
pytest
.
main
(
args
)
...
...
@@ -54,10 +55,19 @@ def run_test_cases(cases_list, case_type):
def
unset_proxy
(
key
):
os
.
unsetenv
(
key
)
def
check_env
():
def
check_env
(
mode
):
if
'https_proxy'
in
os
.
environ
or
'http_proxy'
in
os
.
environ
:
unset_proxy
(
"https_proxy"
)
unset_proxy
(
"http_proxy"
)
run_test_cases
(
inference_test_cases
,
"PaddlePaddle"
)
run_test_cases
(
cpp_test_cases
,
"C++"
)
run_test_cases
(
pipeline_test_cases
,
"Pipeline"
)
is_open_std
=
False
if
mode
is
"debug"
:
is_open_std
=
True
if
mode
is
"all"
or
mode
is
"inference"
or
mode
is
"debug"
:
run_test_cases
(
inference_test_cases
,
"PaddlePaddle"
,
is_open_std
)
if
mode
is
"all"
or
mode
is
"cpp"
or
mode
is
"debug"
:
run_test_cases
(
cpp_test_cases
,
"C++"
,
is_open_std
)
if
mode
is
"all"
or
mode
is
"pipeline"
or
mode
is
"debug"
:
run_test_cases
(
pipeline_test_cases
,
"Pipeline"
,
is_open_std
)
if
__name__
==
'__main__'
:
check_env
(
"debug"
)
python/paddle_serving_server/serve.py
浏览文件 @
011ea89a
...
...
@@ -35,6 +35,7 @@ from paddle_serving_server.env import CONF_HOME
import
signal
from
paddle_serving_server.util
import
*
from
paddle_serving_server.env_check.run
import
check_env
import
cmd
# web_service.py is still used by Pipeline.
...
...
@@ -471,6 +472,35 @@ def stop_serving(command: str, port: int=None):
os
.
remove
(
filepath
)
return
True
class
Check_Env_Shell
(
cmd
.
Cmd
):
intro
=
'Welcome to the check env shell.Type help or ? to list commands.
\n
'
#prompt = '(check) '
# ----- basic commands -----
def
do_check_all
(
self
,
arg
):
'Check Environment of Paddle Inference, Pipeline Serving, C++ Serving'
check_env
(
"all"
)
def
do_check_pipeline
(
self
,
arg
):
'Check Environment of Pipeline Serving'
check_env
(
"pipeline"
)
def
do_check_cpp
(
self
,
arg
):
'Check Environment of C++ Serving'
check_env
(
"cpp"
)
def
do_check_inference
(
self
,
arg
):
'Check Environment of Paddle Inference'
check_env
(
"inference"
)
def
do_debug
(
self
,
arg
):
'Open pytest log to debug'
check_env
(
"debug"
)
def
do_exit
(
self
,
arg
):
'Exit Check Env Shell'
print
(
'Check Environment Shell Exit'
)
os
.
_exit
(
0
)
return
True
if
__name__
==
"__main__"
:
# args.device is not used at all.
...
...
@@ -488,8 +518,7 @@ if __name__ == "__main__":
else
:
os
.
_exit
(
-
1
)
elif
args
.
server
==
"check"
:
check_env
()
os
.
_exit
(
0
)
Check_Env_Shell
().
cmdloop
()
for
single_model_config
in
args
.
model
:
if
os
.
path
.
isdir
(
single_model_config
):
pass
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录