Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
44c1982c
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,发现更多精彩内容 >>
未验证
提交
44c1982c
编写于
3月 12, 2020
作者:
M
MRXLT
提交者:
GitHub
3月 12, 2020
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #265 from MRXLT/general-server-fix
improve error info
上级
d7940b16
193fcfa2
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
16 addition
and
6 deletion
+16
-6
python/paddle_serving_server/__init__.py
python/paddle_serving_server/__init__.py
+8
-3
python/paddle_serving_server_gpu/__init__.py
python/paddle_serving_server_gpu/__init__.py
+8
-3
未找到文件。
python/paddle_serving_server/__init__.py
浏览文件 @
44c1982c
...
...
@@ -206,9 +206,11 @@ class Server(object):
print
(
'Frist time run, downloading PaddleServing components ...'
)
r
=
os
.
system
(
'wget '
+
bin_url
+
' --no-check-certificate'
)
if
r
!=
0
:
print
(
'Download failed'
)
if
os
.
path
.
exists
(
tar_name
):
os
.
remove
(
tar_name
)
raise
SystemExit
(
'Download failed, please check your network or permission of {}.'
.
format
(
self
.
module_path
))
else
:
try
:
print
(
'Decompressing files ..'
)
...
...
@@ -218,6 +220,9 @@ class Server(object):
except
:
if
os
.
path
.
exists
(
exe_path
):
os
.
remove
(
exe_path
)
raise
SystemExit
(
'Decompressing failed, please check your permission of {} or disk space left.'
.
foemat
(
self
.
module_path
))
finally
:
os
.
remove
(
tar_name
)
os
.
chdir
(
self
.
cur_path
)
...
...
@@ -231,7 +236,7 @@ class Server(object):
os
.
system
(
"mkdir {}"
.
format
(
workdir
))
os
.
system
(
"touch {}/fluid_time_file"
.
format
(
workdir
))
if
not
self
.
check_port
(
port
):
if
not
self
.
port_is_available
(
port
):
raise
SystemExit
(
"Prot {} is already used"
.
format
(
port
))
self
.
_prepare_resource
(
workdir
)
self
.
_prepare_engine
(
self
.
model_config_path
,
device
)
...
...
@@ -248,7 +253,7 @@ class Server(object):
self
.
_write_pb_str
(
resource_fn
,
self
.
resource_conf
)
self
.
_write_pb_str
(
model_toolkit_fn
,
self
.
model_toolkit_conf
)
def
check_port
(
self
,
port
):
def
port_is_available
(
self
,
port
):
with
closing
(
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
))
as
sock
:
sock
.
settimeout
(
2
)
result
=
sock
.
connect_ex
((
'127.0.0.1'
,
port
))
...
...
python/paddle_serving_server_gpu/__init__.py
浏览文件 @
44c1982c
...
...
@@ -214,9 +214,11 @@ class Server(object):
print
(
'Frist time run, downloading PaddleServing components ...'
)
r
=
os
.
system
(
'wget '
+
bin_url
+
' --no-check-certificate'
)
if
r
!=
0
:
print
(
'Download failed'
)
if
os
.
path
.
exists
(
tar_name
):
os
.
remove
(
tar_name
)
raise
SystemExit
(
'Download failed, please check your network or permission of {}.'
.
format
(
self
.
module_path
))
else
:
try
:
print
(
'Decompressing files ..'
)
...
...
@@ -226,6 +228,9 @@ class Server(object):
except
:
if
os
.
path
.
exists
(
exe_path
):
os
.
remove
(
exe_path
)
raise
SystemExit
(
'Decompressing failed, please check your permission of {} or disk space left.'
.
format
(
self
.
module_path
))
finally
:
os
.
remove
(
tar_name
)
os
.
chdir
(
self
.
cur_path
)
...
...
@@ -239,7 +244,7 @@ class Server(object):
os
.
system
(
"mkdir {}"
.
format
(
workdir
))
os
.
system
(
"touch {}/fluid_time_file"
.
format
(
workdir
))
if
not
self
.
check_port
(
port
):
if
not
self
.
port_is_available
(
port
):
raise
SystemExit
(
"Prot {} is already used"
.
format
(
port
))
self
.
set_port
(
port
)
...
...
@@ -258,7 +263,7 @@ class Server(object):
self
.
_write_pb_str
(
resource_fn
,
self
.
resource_conf
)
self
.
_write_pb_str
(
model_toolkit_fn
,
self
.
model_toolkit_conf
)
def
check_port
(
self
,
port
):
def
port_is_available
(
self
,
port
):
with
closing
(
socket
.
socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
))
as
sock
:
sock
.
settimeout
(
2
)
result
=
sock
.
connect_ex
((
'127.0.0.1'
,
port
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录