Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
9781fbe1
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看板
提交
9781fbe1
编写于
12月 13, 2021
作者:
B
bjjwwang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix paddle-serving-server
上级
f8d72c68
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
53 addition
and
2 deletion
+53
-2
python/paddle_serving_server/__init__.py
python/paddle_serving_server/__init__.py
+1
-0
python/paddle_serving_server/util.py
python/paddle_serving_server/util.py
+50
-0
python/paddle_serving_server/web_service.py
python/paddle_serving_server/web_service.py
+2
-2
未找到文件。
python/paddle_serving_server/__init__.py
浏览文件 @
9781fbe1
...
...
@@ -28,5 +28,6 @@ from paddle_serving_server import (
from
.dag
import
*
from
.server
import
*
from
.util
import
*
__version__
=
version
.
version_tag
python/paddle_serving_server/util.py
浏览文件 @
9781fbe1
...
...
@@ -131,3 +131,53 @@ def load_pid_file(filepath: str):
os
.
remove
(
filepath
)
print
(
"ProcessInfo.json file is empty, All processes of PaddleServing has been stopped."
)
return
False
import
yaml
from
argparse
import
ArgumentParser
,
RawDescriptionHelpFormatter
class
ArgsParser
(
ArgumentParser
):
def
__init__
(
self
):
super
(
ArgsParser
,
self
).
__init__
(
formatter_class
=
RawDescriptionHelpFormatter
)
self
.
add_argument
(
"-c"
,
"--config"
,
help
=
"configuration file to use"
)
self
.
add_argument
(
"-o"
,
"--opt"
,
nargs
=
'+'
,
help
=
"set configuration options"
)
def
parse_args
(
self
,
argv
=
None
):
args
=
super
(
ArgsParser
,
self
).
parse_args
(
argv
)
assert
args
.
config
is
not
None
,
\
"Please specify --config=configure_file_path."
args
.
conf_dict
=
self
.
_parse_opt
(
args
.
opt
,
args
.
config
)
return
args
def
_parse_helper
(
self
,
v
):
if
v
.
isnumeric
():
if
"."
in
v
:
v
=
float
(
v
)
else
:
v
=
int
(
v
)
elif
v
==
"True"
or
v
==
"False"
:
v
=
(
v
==
"True"
)
return
v
def
_parse_opt
(
self
,
opts
,
conf_path
):
f
=
open
(
conf_path
)
config
=
yaml
.
load
(
f
,
Loader
=
yaml
.
Loader
)
if
not
opts
:
return
config
for
s
in
opts
:
s
=
s
.
strip
()
k
,
v
=
s
.
split
(
'='
)
v
=
self
.
_parse_helper
(
v
)
cur
=
config
parent
=
cur
for
kk
in
k
.
split
(
"."
):
if
kk
not
in
cur
:
cur
[
kk
]
=
{}
parent
=
cur
cur
=
cur
[
kk
]
else
:
parent
=
cur
cur
=
cur
[
kk
]
parent
[
k
.
split
(
"."
)[
-
1
]]
=
v
return
config
python/paddle_serving_server/web_service.py
浏览文件 @
9781fbe1
...
...
@@ -53,7 +53,7 @@ class WebService(object):
def
get_pipeline_response
(
self
,
read_op
):
return
None
def
prepare_pipeline_config
(
self
,
y
aml_fil
e
):
def
prepare_pipeline_config
(
self
,
y
ml_file
=
None
,
yml_dict
=
Non
e
):
# build dag
read_op
=
pipeline
.
RequestOp
()
last_op
=
self
.
get_pipeline_response
(
read_op
)
...
...
@@ -63,7 +63,7 @@ class WebService(object):
"`get_pipeline_response`."
)
response_op
=
pipeline
.
ResponseOp
(
input_ops
=
[
last_op
])
self
.
_server
.
set_response_op
(
response_op
)
self
.
_server
.
prepare_server
(
y
aml_file
)
self
.
_server
.
prepare_server
(
y
ml_file
=
yml_file
,
yml_dict
=
yml_dict
)
def
run_service
(
self
):
self
.
_server
.
run_server
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录