Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
9acdf042
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看板
提交
9acdf042
编写于
7月 06, 2020
作者:
B
barrierye
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update profiler
上级
dc6be190
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
28 addition
and
28 deletion
+28
-28
python/pipeline/dag.py
python/pipeline/dag.py
+11
-11
python/pipeline/operator.py
python/pipeline/operator.py
+17
-17
未找到文件。
python/pipeline/dag.py
浏览文件 @
9acdf042
...
...
@@ -46,7 +46,7 @@ class DAGExecutor(object):
raise
Exception
(
"profile cannot be used in multiprocess version temporarily"
)
self
.
name
=
"
#
G"
self
.
name
=
"
@
G"
self
.
_profiler
=
TimeProfiler
()
self
.
_profiler
.
enable
(
use_profile
)
...
...
@@ -149,23 +149,23 @@ class DAGExecutor(object):
data_id
=
data_id
),
data_id
def
call
(
self
,
rpc_request
):
self
.
_profiler
.
record
(
"
dag-call_0"
.
format
(
self
.
name
)
)
self
.
_profiler
.
record
(
"
call#DAG_0"
)
self
.
_profiler
.
record
(
"
{}-prepack
_0"
.
format
(
self
.
name
))
self
.
_profiler
.
record
(
"
prepack#{}
_0"
.
format
(
self
.
name
))
req_channeldata
,
data_id
=
self
.
_pack_channeldata
(
rpc_request
)
self
.
_profiler
.
record
(
"
{}-prepack
_1"
.
format
(
self
.
name
))
self
.
_profiler
.
record
(
"
prepack#{}
_1"
.
format
(
self
.
name
))
resp_channeldata
=
None
for
i
in
range
(
self
.
_retry
):
_LOGGER
.
debug
(
self
.
_log
(
'push data'
))
#self._profiler.record("
{}-push
_0".format(self.name))
#self._profiler.record("
push#{}
_0".format(self.name))
self
.
_in_channel
.
push
(
req_channeldata
,
self
.
name
)
#self._profiler.record("
{}-push
_1".format(self.name))
#self._profiler.record("
push#{}
_1".format(self.name))
_LOGGER
.
debug
(
self
.
_log
(
'wait for infer'
))
#self._profiler.record("
{}-fetch
_0".format(self.name))
#self._profiler.record("
fetch#{}
_0".format(self.name))
resp_channeldata
=
self
.
_get_channeldata_from_fetch_buffer
(
data_id
)
#self._profiler.record("
{}-fetch
_1".format(self.name))
#self._profiler.record("
fetch#{}
_1".format(self.name))
if
resp_channeldata
.
ecode
==
ChannelDataEcode
.
OK
.
value
:
break
...
...
@@ -173,11 +173,11 @@ class DAGExecutor(object):
_LOGGER
.
warn
(
"retry({}): {}"
.
format
(
i
+
1
,
resp_channeldata
.
error_info
))
self
.
_profiler
.
record
(
"
{}-postpack
_0"
.
format
(
self
.
name
))
self
.
_profiler
.
record
(
"
postpack#{}
_0"
.
format
(
self
.
name
))
rpc_resp
=
self
.
_pack_for_rpc_resp
(
resp_channeldata
)
self
.
_profiler
.
record
(
"
{}-postpack
_1"
.
format
(
self
.
name
))
self
.
_profiler
.
record
(
"
postpack#{}
_1"
.
format
(
self
.
name
))
self
.
_profiler
.
record
(
"
dag-call_1"
.
format
(
self
.
name
)
)
self
.
_profiler
.
record
(
"
call#DAG_1"
)
self
.
_profiler
.
print_profile
()
return
rpc_resp
...
...
python/pipeline/operator.py
浏览文件 @
9acdf042
...
...
@@ -364,9 +364,9 @@ class Op(object):
self
.
_is_run
=
True
while
self
.
_is_run
:
#self._profiler_record("
{}-get#{}_0".format(op_info_prefix, tid
))
#self._profiler_record("
get#{}_0".format(op_info_prefix
))
channeldata_dict
=
input_channel
.
front
(
self
.
name
)
#self._profiler_record("
{}-get#{}_1".format(op_info_prefix, tid
))
#self._profiler_record("
get#{}_1".format(op_info_prefix
))
_LOGGER
.
debug
(
log
(
"input_data: {}"
.
format
(
channeldata_dict
)))
data_id
,
error_channeldata
,
parsed_data
=
self
.
_parse_channeldata
(
...
...
@@ -378,39 +378,39 @@ class Op(object):
continue
# preprecess
self
.
_profiler_record
(
"
{}-prep#{}_0"
.
format
(
op_info_prefix
,
tid
))
self
.
_profiler_record
(
"
prep#{}_0"
.
format
(
op_info_prefix
))
preped_data
,
error_channeldata
=
self
.
_run_preprocess
(
parsed_data
,
data_id
,
private_obj
,
log
)
self
.
_profiler_record
(
"
{}-prep#{}_1"
.
format
(
op_info_prefix
,
tid
))
self
.
_profiler_record
(
"
prep#{}_1"
.
format
(
op_info_prefix
))
if
error_channeldata
is
not
None
:
self
.
_push_to_output_channels
(
error_channeldata
,
output_channels
)
continue
# process
self
.
_profiler_record
(
"
{}-midp#{}_0"
.
format
(
op_info_prefix
,
tid
))
self
.
_profiler_record
(
"
midp#{}_0"
.
format
(
op_info_prefix
))
midped_data
,
error_channeldata
=
self
.
_run_process
(
client_predict_handler
,
preped_data
,
data_id
,
private_obj
,
log
)
self
.
_profiler_record
(
"
{}-midp#{}_1"
.
format
(
op_info_prefix
,
tid
))
self
.
_profiler_record
(
"
midp#{}_1"
.
format
(
op_info_prefix
))
if
error_channeldata
is
not
None
:
self
.
_push_to_output_channels
(
error_channeldata
,
output_channels
)
continue
# postprocess
self
.
_profiler_record
(
"
{}-postp#{}_0"
.
format
(
op_info_prefix
,
tid
))
self
.
_profiler_record
(
"
postp#{}_0"
.
format
(
op_info_prefix
))
output_data
,
error_channeldata
=
self
.
_run_postprocess
(
parsed_data
,
midped_data
,
data_id
,
private_obj
,
log
)
self
.
_profiler_record
(
"
{}-postp#{}_1"
.
format
(
op_info_prefix
,
tid
))
self
.
_profiler_record
(
"
postp#{}_1"
.
format
(
op_info_prefix
))
if
error_channeldata
is
not
None
:
self
.
_push_to_output_channels
(
error_channeldata
,
output_channels
)
continue
# push data to channel (if run succ)
#self._profiler_record("
{}-push#{}_0".format(op_info_prefix, tid
))
#self._profiler_record("
push#{}_0".format(op_info_prefix
))
self
.
_push_to_output_channels
(
output_data
,
output_channels
)
#self._profiler_record("
{}-push#{}_1".format(op_info_prefix, tid
))
#self._profiler_record("
push#{}_1".format(op_info_prefix
))
def
_log
(
self
,
info
):
return
"{} {}"
.
format
(
self
.
name
,
info
)
...
...
@@ -420,9 +420,9 @@ class RequestOp(Op):
""" RequestOp do not run preprocess, process, postprocess. """
def
__init__
(
self
,
concurrency
=
1
):
# PipelineService.name = "
#
G"
# PipelineService.name = "
@
G"
super
(
RequestOp
,
self
).
__init__
(
name
=
"
#
G"
,
input_ops
=
[],
concurrency
=
concurrency
)
name
=
"
@
G"
,
input_ops
=
[],
concurrency
=
concurrency
)
# init op
try
:
self
.
init_op
()
...
...
@@ -447,7 +447,7 @@ class ResponseOp(Op):
def
__init__
(
self
,
input_ops
,
concurrency
=
1
):
super
(
ResponseOp
,
self
).
__init__
(
name
=
"
#
R"
,
input_ops
=
input_ops
,
concurrency
=
concurrency
)
name
=
"
@
R"
,
input_ops
=
input_ops
,
concurrency
=
concurrency
)
# init op
try
:
self
.
init_op
()
...
...
@@ -530,12 +530,12 @@ class VirtualOp(Op):
self
.
_is_run
=
True
while
self
.
_is_run
:
#self._profiler_record("
{}-get#{}_0".format(op_info_prefix, tid
))
#self._profiler_record("
get#{}_0".format(op_info_prefix
))
channeldata_dict
=
input_channel
.
front
(
self
.
name
)
#self._profiler_record("
{}-get#{}_1".format(op_info_prefix, tid
))
#self._profiler_record("
get#{}_1".format(op_info_prefix
))
#self._profiler_record("
{}-push#{}_0".format(op_info_prefix, tid
))
#self._profiler_record("
push#{}_0".format(op_info_prefix
))
for
name
,
data
in
channeldata_dict
.
items
():
self
.
_push_to_output_channels
(
data
,
channels
=
output_channels
,
name
=
name
)
#self._profiler_record("
{}-push#{}_1".format(op_info_prefix, tid
))
#self._profiler_record("
push#{}_1".format(op_info_prefix
))
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录