Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
cc68c13a
S
Serving
项目概览
PaddlePaddle
/
Serving
大约 1 年 前同步成功
通知
185
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
cc68c13a
编写于
4月 04, 2020
作者:
D
Dong Daxiang
提交者:
GitHub
4月 04, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #401 from guru4elephant/fix_multiple_downloads
make single server to download server bin, and other processes should…
上级
a8a4462b
19a509ee
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
25 addition
and
12 deletion
+25
-12
python/paddle_serving_server/__init__.py
python/paddle_serving_server/__init__.py
+1
-0
python/paddle_serving_server_gpu/__init__.py
python/paddle_serving_server_gpu/__init__.py
+18
-3
python/paddle_serving_server_gpu/web_service.py
python/paddle_serving_server_gpu/web_service.py
+6
-9
未找到文件。
python/paddle_serving_server/__init__.py
浏览文件 @
cc68c13a
...
...
@@ -211,6 +211,7 @@ class Server(object):
tar_name
=
floder_name
+
".tar.gz"
bin_url
=
"https://paddle-serving.bj.bcebos.com/bin/"
+
tar_name
self
.
server_path
=
os
.
path
.
join
(
self
.
module_path
,
floder_name
)
if
not
os
.
path
.
exists
(
self
.
server_path
):
print
(
'Frist time run, downloading PaddleServing components ...'
)
r
=
os
.
system
(
'wget '
+
bin_url
+
' --no-check-certificate'
)
...
...
python/paddle_serving_server_gpu/__init__.py
浏览文件 @
cc68c13a
...
...
@@ -20,6 +20,7 @@ import google.protobuf.text_format
import
tarfile
import
socket
import
paddle_serving_server_gpu
as
paddle_serving_server
import
time
from
.version
import
serving_server_version
from
contextlib
import
closing
import
argparse
...
...
@@ -223,11 +224,21 @@ class Server(object):
os
.
chdir
(
self
.
module_path
)
need_download
=
False
device_version
=
"serving-gpu-"
f
lo
der_name
=
device_version
+
serving_server_version
tar_name
=
f
lo
der_name
+
".tar.gz"
f
ol
der_name
=
device_version
+
serving_server_version
tar_name
=
f
ol
der_name
+
".tar.gz"
bin_url
=
"https://paddle-serving.bj.bcebos.com/bin/"
+
tar_name
self
.
server_path
=
os
.
path
.
join
(
self
.
module_path
,
floder_name
)
self
.
server_path
=
os
.
path
.
join
(
self
.
module_path
,
folder_name
)
download_flag
=
"{}/{}.is_download"
.
format
(
self
.
module_path
,
folder_name
)
if
os
.
path
.
exists
(
download_flag
):
os
.
chdir
(
self
.
cur_path
)
self
.
bin_path
=
self
.
server_path
+
"/serving"
return
if
not
os
.
path
.
exists
(
self
.
server_path
):
os
.
system
(
"touch {}/{}.is_download"
.
format
(
self
.
module_path
,
folder_name
))
print
(
'Frist time run, downloading PaddleServing components ...'
)
r
=
os
.
system
(
'wget '
+
bin_url
+
' --no-check-certificate'
)
if
r
!=
0
:
...
...
@@ -326,4 +337,8 @@ class Server(object):
self
.
gpuid
,)
print
(
"Going to Run Comand"
)
print
(
command
)
# wait for other process to download server bin
while
not
os
.
path
.
exists
(
self
.
server_path
):
time
.
sleep
(
1
)
os
.
system
(
command
)
python/paddle_serving_server_gpu/web_service.py
浏览文件 @
cc68c13a
...
...
@@ -66,6 +66,12 @@ class WebService(object):
return
server
def
_launch_rpc_service
(
self
,
service_idx
):
if
service_idx
==
0
:
self
.
rpc_service_list
[
service_idx
].
check_local_bin
()
if
not
self
.
rpc_service_list
[
service_idx
].
use_local_bin
:
self
.
rpc_service_list
[
service_idx
].
download_bin
()
else
:
time
.
sleep
(
3
)
self
.
rpc_service_list
[
service_idx
].
run_server
()
def
prepare_server
(
self
,
workdir
=
""
,
port
=
9393
,
device
=
"gpu"
,
gpuid
=
0
):
...
...
@@ -160,15 +166,6 @@ class WebService(object):
if
not
isinstance
(
result
,
dict
)
and
result
==
-
1
:
result
=
{
"result"
:
"Request Value Error"
}
return
result
'''
feed, fetch = self.preprocess(request.json, request.json["fetch"])
if "fetch" in feed:
del feed["fetch"]
fetch_map = client.predict(feed=feed, fetch=fetch)
fetch_map = self.postprocess(
feed=request.json, fetch=fetch, fetch_map=fetch_map)
return fetch_map
'''
app_instance
.
run
(
host
=
"0.0.0.0"
,
port
=
self
.
port
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录