-
Notifications
You must be signed in to change notification settings - Fork 1.3k
add timeout test #261
base: develop
Are you sure you want to change the base?
add timeout test #261
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
#!/bin/bash | ||
command -v go >/dev/null 2>&1 | ||
if [ $? -ne 0 ]; then | ||
if [[ $? -ne 0 ]]; then | ||
echo >&2 "Please install go https://golang.org/doc/install#install" | ||
exit 1 | ||
fi | ||
|
@@ -13,7 +13,7 @@ cd $cur_path/../ | |
#convert md to ipynb | ||
for file in */{README,README\.en}.md ; do | ||
~/go/bin/markdown-to-ipynb < $file > ${file%.*}".ipynb" | ||
if [ $? -ne 0 ]; then | ||
if [[ $? -ne 0 ]]; then | ||
echo >&2 "markdown-to-ipynb $file error" | ||
exit 1 | ||
fi | ||
|
@@ -29,7 +29,19 @@ for file in */{README,README\.en}.ipynb ; do | |
cd $(dirname $file) > /dev/null | ||
|
||
echo "begin test $file" | ||
jupyter nbconvert --to python $(basename $file) --stdout | python | ||
if [[ $(dirname $file) == "08.recommender_system" ]]; then | ||
timeout -s SIGKILL 30 bash -c \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 这里用了 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 根据这里的讨论,最好不用set -e |
||
"jupyter nbconvert --to python $(basename $file) --stdout | \ | ||
sed 's/get_ipython()\.magic(.*'\''matplotlib inline'\'')/\#matplotlib inline/g' | \ | ||
sed '/^# coding: utf-8/a\import matplotlib\nmatplotlib.use('\''Agg'\'')' | python" | ||
else | ||
timeout -s SIGKILL 30 bash -c "jupyter nbconvert --to python $(basename $file) --stdout | python" | ||
fi | ||
|
||
if [[ $? -ne 0 && $? -ne 124 && $? -ne 137 ]]; then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 为什么124和137返回是正确的呢? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
确实不用写124,137还是需要的 |
||
echo >&2 "exec $file error!" | ||
exit 1 | ||
fi | ||
|
||
popd > /dev/null | ||
#break | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为什么recommender system的处理方式和其他chapter不同呢?
看上去是因为不想调用绘制函数? @jacquesqiao 和其他人正在给所有chapters加上绘图功能,是不是到时候都需要特殊处理呢?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
是有这个问题。调用绘制函数会有两个问题
不过,如果都加上了,反而不用特殊处理了。因为大家都一样用sed替换了。没加上的反而特殊处理了。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
可否可 @jacquesqiao 聊一下这个问题?我理解绘图会封装到 @jacquesqiao 写的 paddle.v2.plot.X 里。是不是可以调用方式是:
然后通过给
new
函数增加一个参数dry_run=true
,让new
函数以及之后和绘图相关的功能都被disable掉?也就是用sed把
变成
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1,测试了下,只要调用 import matplotlib.pyplot 就会挂
2,我看看能不能通过其他方式选择是否调用 import matplotlib.pyplot
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
我记得import 可以写在函数定义里的?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PaddlePaddle/Paddle#1712
测试了下,通过一个环境变量来决定是否import matplotlib.pyplot。
测试的时候只需要
export DISABLE_PLOT=True
就不会挂了
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
龙飞的提交了以后告诉我一声,我根据你的pr进行一下修改,然后再merge进去 @jacquesqiao
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
好的