Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
3f5a1c90
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看板
提交
3f5a1c90
编写于
3月 09, 2020
作者:
G
guru4elephant
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add more files
上级
3a494499
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
160 addition
and
0 deletion
+160
-0
.travis.yml
.travis.yml
+13
-0
tools/Dockerfile.ci
tools/Dockerfile.ci
+23
-0
tools/serving-build.sh
tools/serving-build.sh
+124
-0
未找到文件。
.travis.yml
0 → 100644
浏览文件 @
3f5a1c90
language
:
generic
sudo
:
required
dist
:
trusty
os
:
-
linux
env
:
-
COMPILE_TYPE=CPU DOCKERFILE_CPU=$PWD/tools/Dockerfile.ci
services
:
-
docker
before_install
:
-
docker build -f ${DOCKERFILE_CPU} -t serving-img:${COMPILE_TYPE} .
install
:
-
docker run -it -v $PWD:/Serving serving-img:${COMPILE_TYPE} /bin/bash Serving/tools/serving-build.sh $COMPILE_TYPE
tools/Dockerfile.ci
0 → 100644
浏览文件 @
3f5a1c90
FROM centos:7.3.1611
RUN yum -y install wget \
&& yum -y install gcc gcc-c++ make glibc-static which \
&& yum -y install git openssl-devel curl-devel bzip2-devel python-devel \
&& wget https://cmake.org/files/v3.2/cmake-3.2.0-Linux-x86_64.tar.gz \
&& tar xzf cmake-3.2.0-Linux-x86_64.tar.gz \
&& mv cmake-3.2.0-Linux-x86_64 /usr/local/cmake3.2.0 \
&& echo 'export PATH=/usr/local/cmake3.2.0/bin:$PATH' >> /root/.bashrc \
&& wget https://dl.google.com/go/go1.14.linux-amd64.tar.gz \
&& tar xzf go1.14.linux-amd64.tar.gz \
&& mv go /usr/local/go \
&& echo 'export GOROOT=/usr/local/go' >> /root/.bashrc \
&& echo 'export PATH=/usr/local/go/bin:$PATH' >> /root/.bashrc \
&& yum -y install python-devel sqlite-devel \
&& curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py >/dev/null \
&& python get-pip.py >/dev/null \
&& pip install google protobuf setuptools wheel flask >/dev/null \
&& wget http://nixos.org/releases/patchelf/patchelf-0.10/patchelf-0.10.tar.bz2 \
&& yum -y install bzip2 \
&& tar -jxf patchelf-0.10.tar.bz2 \
&& cd patchelf-0.10 \
&& ./configure --prefix=/usr \
&& make >/dev/null && make install >/dev/null
tools/serving-build.sh
0 → 100644
浏览文件 @
3f5a1c90
#!/usr/bin/env bash
function
init
()
{
source
/root/.bashrc
set
-v
#export http_proxy=http://172.19.56.199:3128
#export https_proxy=http://172.19.56.199:3128
export
PYTHONROOT
=
/usr
cd
Serving
}
function
check_cmd
()
{
eval
$@
if
[
$?
-ne
0
]
;
then
exit
1
fi
}
function
build_client
()
{
local
TYPE
=
$1
local
DIRNAME
=
build-client-
$TYPE
mkdir
$DIRNAME
&&
cd
$DIRNAME
case
$TYPE
in
CPU|GPU
)
cmake
-DPYTHON_INCLUDE_DIR
=
$PYTHONROOT
/include/python2.7/
\
-DPYTHON_LIBRARIES
=
$PYTHONROOT
/lib64/libpython2.7.so
\
-DPYTHON_EXECUTABLE
=
$PYTHONROOT
/bin/python
\
-DCLIENT_ONLY
=
ON ..
check_cmd
"make -j2 >/dev/null"
pip
install
python/dist/paddle_serving_client
*
>
/dev/null
;;
*
)
echo
"error type"
exit
1
;;
esac
echo
"build client
$TYPE
part finished as expected."
cd
..
rm
-rf
$DIRNAME
}
function
build_server
()
{
local
TYPE
=
$1
local
DIRNAME
=
build-server-
$TYPE
mkdir
$DIRNAME
&&
cd
$DIRNAME
case
$TYPE
in
CPU
)
cmake
-DPYTHON_INCLUDE_DIR
=
$PYTHONROOT
/include/python2.7/
\
-DPYTHON_LIBRARIES
=
$PYTHONROOT
/lib64/libpython2.7.so
\
-DPYTHON_EXECUTABLE
=
$PYTHONROOT
/bin/python
\
-DCLIENT_ONLY
=
OFF ..
check_cmd
"make -j2 >/dev/null"
pip
install
python/dist/paddle_serving_server
*
>
/dev/null
;;
GPU
)
cmake
-DPYTHON_INCLUDE_DIR
=
$PYTHONROOT
/include/python2.7/
\
-DPYTHON_LIBRARIES
=
$PYTHONROOT
/lib64/libpython2.7.so
\
-DPYTHON_EXECUTABLE
=
$PYTHONROOT
/bin/python
\
-DCLIENT_ONLY
=
OFF
\
-DWITH_GPU
=
ON ..
check_cmd
"make -j2 >/dev/null"
pip
install
python/dist/paddle_serving_server
*
>
/dev/null
;;
*
)
echo
"error type"
exit
1
;;
esac
echo
"build server
$TYPE
part finished as expected."
cd
..
rm
-rf
$DIRNAME
}
function
python_test_fit_a_line
()
{
cd
fit_a_line
sh get_data.sh
local
TYPE
=
$1
case
$TYPE
in
CPU
)
# test rpc
check_cmd
"python test_server.py uci_housing_model/ > /dev/null &"
sleep
5
check_cmd
"python test_client.py uci_housing_client/serving_client_conf.prototxt > /dev/null"
ps
-ef
|
grep
"paddle_serving_server"
|
grep
-v
grep
|
awk
'{print $2}'
| xargs
kill
# test web
check_cmd
"python -m paddle_serving_server.web_serve --model uci_housing_model/ --name uci --port 9399 --name uci > /dev/null &"
sleep
5
check_cmd
"curl -H
\"
Content-Type:application/json
\"
-X POST -d '{
\"
x
\"
: [0.0137, -0.1136, 0.2553, -0.0692, 0.0582, -0.0727, -0.1583, -0.0584, 0.6283, 0.4919, 0.1856, 0.0795, -0.0332],
\"
fetch
\"
:[
\"
price
\"
]}' http://127.0.0.1:9399/uci/prediction"
ps
-ef
|
grep
"paddle_serving_server"
|
grep
-v
grep
|
awk
'{print $2}'
| xargs
kill
;;
GPU
)
echo
"not support yet"
exit
1
;;
*
)
echo
"error type"
exit
1
;;
esac
echo
"test fit_a_line
$TYPE
part finished as expected."
rm
-rf
image kvdb log uci_housing
*
work
*
cd
..
}
function
python_run_test
()
{
cd
python/examples
local
TYPE
=
$1
# Frist time run, downloading PaddleServing components ...
python
-c
"from paddle_serving_server import Server; server = Server(); server.download_bin()"
python_test_fit_a_line
$TYPE
echo
"test python
$TYPE
part finished as expected."
cd
../..
}
function
main
()
{
local
TYPE
=
$1
init
build_client
$TYPE
build_server
$TYPE
python_run_test
$TYPE
echo
"serving
$TYPE
part finished as expected."
}
main
$@
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录