Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
b3245865
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,发现更多精彩内容 >>
提交
b3245865
编写于
7月 31, 2020
作者:
B
barriery
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
bug fix
上级
c9cd9e02
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
31 addition
and
24 deletion
+31
-24
python/pipeline/dag.py
python/pipeline/dag.py
+14
-9
tools/serving_build.sh
tools/serving_build.sh
+17
-15
未找到文件。
python/pipeline/dag.py
浏览文件 @
b3245865
...
@@ -102,11 +102,16 @@ class DAGExecutor(object):
...
@@ -102,11 +102,16 @@ class DAGExecutor(object):
_LOGGER
.
info
(
"[DAG Executor] succ stop"
)
_LOGGER
.
info
(
"[DAG Executor] succ stop"
)
def
_get_next_data_id
(
self
):
def
_get_next_data_id
(
self
):
data_id
=
None
with
self
.
_id_lock
:
with
self
.
_id_lock
:
if
self
.
_id_counter
>=
self
.
_reset_max_id
:
if
self
.
_id_counter
>=
self
.
_reset_max_id
:
self
.
_id_counter
-=
self
.
_reset_max_id
self
.
_id_counter
-=
self
.
_reset_max_id
data_id
=
self
.
_id_counter
self
.
_id_counter
+=
1
self
.
_id_counter
+=
1
return
self
.
_id_counter
-
1
cond_v
=
threading
.
Condition
()
with
self
.
_cv_for_cv_pool
:
self
.
_cv_pool
[
data_id
]
=
cond_v
return
data_id
,
cond_v
def
_set_in_channel
(
self
,
in_channel
):
def
_set_in_channel
(
self
,
in_channel
):
if
not
isinstance
(
in_channel
,
(
ThreadChannel
,
ProcessChannel
)):
if
not
isinstance
(
in_channel
,
(
ThreadChannel
,
ProcessChannel
)):
...
@@ -159,13 +164,10 @@ class DAGExecutor(object):
...
@@ -159,13 +164,10 @@ class DAGExecutor(object):
self
.
_fetch_buffer
=
channeldata
self
.
_fetch_buffer
=
channeldata
cv
.
notify_all
()
cv
.
notify_all
()
def
_get_channeldata_from_fetch_buffer
(
self
,
data_id
):
def
_get_channeldata_from_fetch_buffer
(
self
,
data_id
,
cond_v
):
resp
=
None
resp
=
None
cv
=
threading
.
Condition
()
with
cond_v
:
with
self
.
_cv_for_cv_pool
:
cond_v
.
wait
()
self
.
_cv_pool
[
data_id
]
=
cv
with
cv
:
cv
.
wait
()
with
self
.
_cv_for_cv_pool
:
with
self
.
_cv_for_cv_pool
:
resp
=
copy
.
deepcopy
(
self
.
_fetch_buffer
)
resp
=
copy
.
deepcopy
(
self
.
_fetch_buffer
)
_LOGGER
.
debug
(
"resp thread get resp data[{}]"
.
format
(
data_id
))
_LOGGER
.
debug
(
"resp thread get resp data[{}]"
.
format
(
data_id
))
...
@@ -201,7 +203,7 @@ class DAGExecutor(object):
...
@@ -201,7 +203,7 @@ class DAGExecutor(object):
client_need_profile
=
client_need_profile
)
client_need_profile
=
client_need_profile
)
def
call
(
self
,
rpc_request
):
def
call
(
self
,
rpc_request
):
data_id
=
self
.
_get_next_data_id
()
data_id
,
cond_v
=
self
.
_get_next_data_id
()
_LOGGER
.
debug
(
"generate id: {}"
.
format
(
data_id
))
_LOGGER
.
debug
(
"generate id: {}"
.
format
(
data_id
))
if
not
self
.
_is_thread_op
:
if
not
self
.
_is_thread_op
:
...
@@ -222,6 +224,8 @@ class DAGExecutor(object):
...
@@ -222,6 +224,8 @@ class DAGExecutor(object):
self
.
_in_channel
.
push
(
req_channeldata
,
self
.
name
)
self
.
_in_channel
.
push
(
req_channeldata
,
self
.
name
)
except
ChannelStopError
:
except
ChannelStopError
:
_LOGGER
.
debug
(
"[DAG Executor] channel stop."
)
_LOGGER
.
debug
(
"[DAG Executor] channel stop."
)
with
self
.
_cv_for_cv_pool
:
self
.
_cv_pool
.
pop
(
data_id
)
return
self
.
_pack_for_rpc_resp
(
return
self
.
_pack_for_rpc_resp
(
ChannelData
(
ChannelData
(
ecode
=
ChannelDataEcode
.
CLOSED_ERROR
.
value
,
ecode
=
ChannelDataEcode
.
CLOSED_ERROR
.
value
,
...
@@ -230,7 +234,8 @@ class DAGExecutor(object):
...
@@ -230,7 +234,8 @@ class DAGExecutor(object):
_LOGGER
.
debug
(
"wait for Graph engine for data[{}]..."
.
format
(
_LOGGER
.
debug
(
"wait for Graph engine for data[{}]..."
.
format
(
data_id
))
data_id
))
resp_channeldata
=
self
.
_get_channeldata_from_fetch_buffer
(
data_id
)
resp_channeldata
=
self
.
_get_channeldata_from_fetch_buffer
(
data_id
,
cond_v
)
if
resp_channeldata
.
ecode
==
ChannelDataEcode
.
OK
.
value
:
if
resp_channeldata
.
ecode
==
ChannelDataEcode
.
OK
.
value
:
_LOGGER
.
debug
(
"Graph engine predict data[{}] succ"
.
format
(
_LOGGER
.
debug
(
"Graph engine predict data[{}] succ"
.
format
(
...
...
tools/serving_build.sh
浏览文件 @
b3245865
...
@@ -779,7 +779,7 @@ function python_test_pipeline(){
...
@@ -779,7 +779,7 @@ function python_test_pipeline(){
# test: thread servicer & thread op
# test: thread servicer & thread op
cat
<<
EOF
> config.yml
cat
<<
EOF
> config.yml
port: 18080
port: 18080
worker_num:
2
worker_num:
4
build_dag_each_worker: false
build_dag_each_worker: false
dag:
dag:
is_thread_op: true
is_thread_op: true
...
@@ -796,7 +796,7 @@ EOF
...
@@ -796,7 +796,7 @@ EOF
# test: thread servicer & process op
# test: thread servicer & process op
cat
<<
EOF
> config.yml
cat
<<
EOF
> config.yml
port: 18080
port: 18080
worker_num:
2
worker_num:
4
build_dag_each_worker: false
build_dag_each_worker: false
dag:
dag:
is_thread_op: false
is_thread_op: false
...
@@ -810,13 +810,13 @@ EOF
...
@@ -810,13 +810,13 @@ EOF
ps
-ef
|
grep
"pipeline_server"
|
grep
-v
grep
|
awk
'{print $2}'
| xargs
kill
ps
-ef
|
grep
"pipeline_server"
|
grep
-v
grep
|
awk
'{print $2}'
| xargs
kill
kill_process_by_port 18080
kill_process_by_port 18080
# test: process servicer &
thread
op
# test: process servicer &
process
op
cat
<<
EOF
> config.yml
cat
<<
EOF
> config.yml
port: 18080
port: 18080
worker_num:
2
worker_num:
4
build_dag_each_worker:
tru
e
build_dag_each_worker:
fals
e
dag:
dag:
is_thread_op: f
la
se
is_thread_op: f
al
se
client_type: brpc
client_type: brpc
retry: 1
retry: 1
use_profile: false
use_profile: false
...
@@ -826,14 +826,20 @@ EOF
...
@@ -826,14 +826,20 @@ EOF
check_cmd
"python test_pipeline_client.py"
check_cmd
"python test_pipeline_client.py"
ps
-ef
|
grep
"pipeline_server"
|
grep
-v
grep
|
awk
'{print $2}'
| xargs
kill
ps
-ef
|
grep
"pipeline_server"
|
grep
-v
grep
|
awk
'{print $2}'
| xargs
kill
kill_process_by_port 18080
kill_process_by_port 18080
kill_server_process
kill_process_by_port 9292
kill_process_by_port 9393
# test: process servicer & process op
# test: process servicer & thread op
pip uninstall grpcio
pip
install
grpcio
--no-binary
=
grpcio
cat
<<
EOF
> config.yml
cat
<<
EOF
> config.yml
port: 18080
port: 18080
worker_num:
2
worker_num:
4
build_dag_each_worker:
fals
e
build_dag_each_worker:
tru
e
dag:
dag:
is_thread_op: f
al
se
is_thread_op: f
la
se
client_type: brpc
client_type: brpc
retry: 1
retry: 1
use_profile: false
use_profile: false
...
@@ -843,10 +849,6 @@ EOF
...
@@ -843,10 +849,6 @@ EOF
check_cmd
"python test_pipeline_client.py"
check_cmd
"python test_pipeline_client.py"
ps
-ef
|
grep
"pipeline_server"
|
grep
-v
grep
|
awk
'{print $2}'
| xargs
kill
ps
-ef
|
grep
"pipeline_server"
|
grep
-v
grep
|
awk
'{print $2}'
| xargs
kill
kill_process_by_port 18080
kill_process_by_port 18080
kill_server_process
kill_process_by_port 9292
kill_process_by_port 9393
# start paddle serving service (grpc)
# start paddle serving service (grpc)
python
-m
paddle_serving_server.serve
--model
imdb_cnn_model
--port
9292
--use_multilang
--workdir
test9292 &> cnn.log &
python
-m
paddle_serving_server.serve
--model
imdb_cnn_model
--port
9292
--use_multilang
--workdir
test9292 &> cnn.log &
...
@@ -854,7 +856,7 @@ EOF
...
@@ -854,7 +856,7 @@ EOF
sleep
5
sleep
5
cat
<<
EOF
> config.yml
cat
<<
EOF
> config.yml
port: 18080
port: 18080
worker_num:
2
worker_num:
4
build_dag_each_worker: false
build_dag_each_worker: false
dag:
dag:
is_thread_op: false
is_thread_op: false
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录