Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PARL
提交
c3b34fd9
P
PARL
项目概览
PaddlePaddle
/
PARL
通知
67
Star
3
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
18
列表
看板
标记
里程碑
合并请求
3
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PARL
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
18
Issue
18
列表
看板
标记
里程碑
合并请求
3
合并请求
3
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
c3b34fd9
编写于
6月 04, 2019
作者:
H
Hongsheng Zeng
提交者:
Bo Zhou
6月 04, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add exception traceback of remote function calling (#79)
* add traceback of remote function calling * assert traceback information
上级
48fc1de8
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
31 addition
and
5 deletion
+31
-5
parl/remote/remote_decorator.py
parl/remote/remote_decorator.py
+6
-2
parl/remote/tests/remote_test.py
parl/remote/tests/remote_test.py
+25
-3
未找到文件。
parl/remote/remote_decorator.py
浏览文件 @
c3b34fd9
...
...
@@ -16,6 +16,7 @@ import numpy as np
import
pyarrow
import
threading
import
time
import
traceback
import
zmq
from
parl.remote
import
remote_constants
from
parl.utils
import
get_ip_address
,
logger
,
to_str
,
to_byte
...
...
@@ -179,7 +180,7 @@ def remote_class(cls):
except
Exception
as
e
:
error_str
=
str
(
e
)
logger
.
error
(
e
)
logger
.
error
(
e
rror_str
)
if
type
(
e
)
==
AttributeError
:
self
.
reply_socket
.
send_multipart
([
...
...
@@ -197,9 +198,12 @@ def remote_class(cls):
to_byte
(
error_str
)
])
else
:
traceback_str
=
str
(
traceback
.
format_exc
())
logger
.
error
(
'traceback:
\n
{}'
.
format
(
traceback_str
))
self
.
reply_socket
.
send_multipart
([
remote_constants
.
EXCEPTION_TAG
,
to_byte
(
error_str
)
to_byte
(
error_str
+
'
\n
traceback:
\n
'
+
traceback_str
)
])
continue
...
...
parl/remote/tests/remote_test.py
浏览文件 @
c3b34fd9
...
...
@@ -50,6 +50,9 @@ class Simulator:
value
+=
1
return
value
def
will_raise_exeception_func
(
self
):
x
=
1
/
0
class
TestRemote
(
unittest
.
TestCase
):
def
_setUp
(
self
,
server_port
):
...
...
@@ -91,7 +94,8 @@ class TestRemote(unittest.TestCase):
try
:
remote_sim
.
get_arg3
()
except
RemoteAttributeError
:
except
RemoteAttributeError
as
e
:
logger
.
info
(
'Expected exception: {}'
.
format
(
e
))
# expected
return
...
...
@@ -105,7 +109,8 @@ class TestRemote(unittest.TestCase):
try
:
remote_sim
.
set_arg3
(
3
)
except
RemoteAttributeError
:
except
RemoteAttributeError
as
e
:
logger
.
info
(
'Expected exception: {}'
.
format
(
e
))
# expected
return
...
...
@@ -119,7 +124,8 @@ class TestRemote(unittest.TestCase):
try
:
remote_sim
.
set_arg1
(
wrong_arg
=
1
)
except
RemoteError
:
except
RemoteError
as
e
:
logger
.
info
(
'Expected exception: {}'
.
format
(
e
))
# expected
return
...
...
@@ -277,6 +283,22 @@ class TestRemote(unittest.TestCase):
for
t
in
threads
:
t
.
join
()
def
test_remote_object_with_call_raise_exception_function
(
self
):
server_port
=
17781
self
.
_setUp
(
server_port
)
remote_sim
=
self
.
remote_manager
.
get_remote
()
try
:
remote_sim
.
will_raise_exeception_func
()
except
RemoteError
as
e
:
assert
'Traceback (most recent call last)'
in
str
(
e
)
logger
.
info
(
'Expected exception: {}'
.
format
(
e
))
# expected
return
assert
False
def
_run_remote_add
(
self
,
remote_sim
):
value
=
0
for
i
in
range
(
1000
):
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录