Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
30f1b53c
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看板
提交
30f1b53c
编写于
5月 28, 2020
作者:
M
MRXLT
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add lock for bin download
上级
8292b8a4
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
15 addition
and
4 deletion
+15
-4
python/paddle_serving_server/__init__.py
python/paddle_serving_server/__init__.py
+7
-0
python/paddle_serving_server_gpu/__init__.py
python/paddle_serving_server_gpu/__init__.py
+8
-4
未找到文件。
python/paddle_serving_server/__init__.py
浏览文件 @
30f1b53c
...
...
@@ -23,6 +23,7 @@ import paddle_serving_server as paddle_serving_server
from
.version
import
serving_server_version
from
contextlib
import
closing
import
collections
import
fcntl
class
OpMaker
(
object
):
...
...
@@ -322,6 +323,10 @@ class Server(object):
bin_url
=
"https://paddle-serving.bj.bcebos.com/bin/"
+
tar_name
self
.
server_path
=
os
.
path
.
join
(
self
.
module_path
,
floder_name
)
#acquire lock
version_file
=
open
(
"{}/version.py"
.
format
(
self
.
module_path
),
"r"
)
fcntl
.
flock
(
version_file
,
fcntl
.
LOCK_EX
)
if
not
os
.
path
.
exists
(
self
.
server_path
):
print
(
'Frist time run, downloading PaddleServing components ...'
)
r
=
os
.
system
(
'wget '
+
bin_url
+
' --no-check-certificate'
)
...
...
@@ -345,6 +350,8 @@ class Server(object):
foemat
(
self
.
module_path
))
finally
:
os
.
remove
(
tar_name
)
#release lock
version_file
.
close
()
os
.
chdir
(
self
.
cur_path
)
self
.
bin_path
=
self
.
server_path
+
"/serving"
...
...
python/paddle_serving_server_gpu/__init__.py
浏览文件 @
30f1b53c
...
...
@@ -25,7 +25,7 @@ from .version import serving_server_version
from
contextlib
import
closing
import
argparse
import
collections
import
multiprocessing
import
fcntl
def
serve_args
():
...
...
@@ -178,7 +178,6 @@ class Server(object):
self
.
use_local_bin
=
False
self
.
gpuid
=
0
self
.
model_config_paths
=
None
# for multi-model in a workflow
self
.
lock
=
multiprocessing
.
Lock
()
def
set_max_concurrency
(
self
,
concurrency
):
self
.
max_concurrency
=
concurrency
...
...
@@ -339,7 +338,6 @@ class Server(object):
# print config here
def
download_bin
(
self
):
self
.
lock
.
acquire
()
os
.
chdir
(
self
.
module_path
)
need_download
=
False
device_version
=
"serving-gpu-"
...
...
@@ -350,6 +348,11 @@ class Server(object):
download_flag
=
"{}/{}.is_download"
.
format
(
self
.
module_path
,
folder_name
)
#acquire lock
version_file
=
open
(
"{}/version.py"
.
format
(
self
.
module_path
),
"r"
)
fcntl
.
flock
(
version_file
,
fcntl
.
LOCK_EX
)
if
os
.
path
.
exists
(
download_flag
):
os
.
chdir
(
self
.
cur_path
)
self
.
bin_path
=
self
.
server_path
+
"/serving"
...
...
@@ -380,9 +383,10 @@ class Server(object):
format
(
self
.
module_path
))
finally
:
os
.
remove
(
tar_name
)
#release lock
version_file
.
cloes
()
os
.
chdir
(
self
.
cur_path
)
self
.
bin_path
=
self
.
server_path
+
"/serving"
self
.
lock
.
release
()
def
prepare_server
(
self
,
workdir
=
None
,
port
=
9292
,
device
=
"cpu"
):
if
workdir
==
None
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录