Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Serving
提交
1655467e
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,发现更多精彩内容 >>
提交
1655467e
编写于
7月 17, 2020
作者:
B
barrierye
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add ci for java sdk
上级
5ea72c18
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
110 addition
and
14 deletion
+110
-14
java/examples/src/main/java/PaddleServingClientExample.java
java/examples/src/main/java/PaddleServingClientExample.java
+5
-0
java/src/main/java/io/paddle/serving/client/Client.java
java/src/main/java/io/paddle/serving/client/Client.java
+3
-2
tools/Dockerfile.ci
tools/Dockerfile.ci
+23
-12
tools/serving_build.sh
tools/serving_build.sh
+79
-0
未找到文件。
java/examples/src/main/java/PaddleServingClientExample.java
浏览文件 @
1655467e
...
...
@@ -85,6 +85,11 @@ public class PaddleServingClientExample {
System
.
out
.
println
(
"connect failed."
);
return
false
;
}
succ
=
client
.
setRpcTimeoutMs
(
10000
);
// cpu
if
(
succ
!=
true
)
{
System
.
out
.
println
(
"set timeout failed."
);
return
false
;
}
Map
<
String
,
INDArray
>
fetch_map
=
client
.
predict
(
feed_data
,
fetch
);
if
(
fetch_map
==
null
)
{
...
...
java/src/main/java/io/paddle/serving/client/Client.java
浏览文件 @
1655467e
...
...
@@ -91,9 +91,10 @@ public class Client {
profiler_
.
enable
(
is_profile
);
}
public
boolean
setRpcTimeoutMs
(
int
rpc_timeout
)
throws
NullPointerException
{
public
boolean
setRpcTimeoutMs
(
int
rpc_timeout
)
{
if
(
futureStub_
==
null
||
blockingStub_
==
null
)
{
throw
new
NullPointerException
(
"set timeout must be set after connect."
);
System
.
out
.
println
(
"set timeout must be set after connect."
);
return
false
;
}
rpcTimeoutS_
=
rpc_timeout
/
1000.0
;
SetTimeoutRequest
timeout_req
=
SetTimeoutRequest
.
newBuilder
()
...
...
tools/Dockerfile.ci
浏览文件 @
1655467e
FROM centos:7.3.1611
RUN yum -y install wget >/dev/null \
&& yum -y install gcc gcc-c++ make glibc-static which >/dev/null \
&& yum -y install git openssl-devel curl-devel bzip2-devel python-devel >/dev/null \
&& yum -y install libSM-1.2.2-2.el7.x86_64 --setopt=protected_multilib=false \
&& yum -y install libXrender-0.9.10-1.el7.x86_64 --setopt=protected_multilib=false \
&& yum -y install libXext-1.3.3-3.el7.x86_64 --setopt=protected_multilib=false \
&& wget https://cmake.org/files/v3.2/cmake-3.2.0-Linux-x86_64.tar.gz >/dev/null \
&& yum -y install libXext-1.3.3-3.el7.x86_64 --setopt=protected_multilib=false
RUN wget https://cmake.org/files/v3.2/cmake-3.2.0-Linux-x86_64.tar.gz >/dev/null \
&& 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 \
&& rm cmake-3.2.0-Linux-x86_64.tar.gz \
&& wget https://dl.google.com/go/go1.14.linux-amd64.tar.gz >/dev/null \
&& rm cmake-3.2.0-Linux-x86_64.tar.gz
RUN wget https://dl.google.com/go/go1.14.linux-amd64.tar.gz >/dev/null \
&& 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 \
&& rm go1.14.linux-amd64.tar.gz \
&& yum -y install python-devel sqlite-devel >/dev/null \
&& rm go1.14.linux-amd64.tar.gz
RUN yum -y install python-devel sqlite-devel >/dev/null \
&& 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 \
&& rm get-pip.py \
&& wget http://nixos.org/releases/patchelf/patchelf-0.10/patchelf-0.10.tar.bz2 \
&& rm get-pip.py
RUN wget http://nixos.org/releases/patchelf/patchelf-0.10/patchelf-0.10.tar.bz2 \
&& yum -y install bzip2 >/dev/null \
&& tar -jxf patchelf-0.10.tar.bz2 \
&& cd patchelf-0.10 \
&& ./configure --prefix=/usr \
&& make >/dev/null && make install >/dev/null \
&& cd .. \
&& rm -rf patchelf-0.10* \
&& yum install -y python3 python3-devel \
&& pip3 install google protobuf setuptools wheel flask \
&& yum -y update >/dev/null \
&& rm -rf patchelf-0.10*
RUN yum install -y python3 python3-devel \
&& pip3 install google protobuf setuptools wheel flask
RUN yum -y update >/dev/null \
&& yum -y install dnf >/dev/null \
&& yum -y install dnf-plugins-core >/dev/null \
&& dnf copr enable alonid/llvm-3.8.0 -y \
&& dnf install llvm-3.8.0 clang-3.8.0 compiler-rt-3.8.0 -y \
&& echo 'export PATH=/opt/llvm-3.8.0/bin:$PATH' >> /root/.bashrc
RUN yum install -y java \
&& wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo \
&& yum install -y apache-maven
tools/serving_build.sh
浏览文件 @
1655467e
...
...
@@ -499,6 +499,84 @@ function python_test_lac() {
cd
..
}
function
java_run_test
()
{
# pwd: /Serving
# compile java sdk
cd
java
# pwd: /Serving/java
mvn compile
mvn
install
# compile java sdk example
cd
examples
# pwd: /Serving/java/examples
mvn compile
mvn
install
local
TYPE
=
$1
export
SERVING_BIN
=
${
SERVING_WORKDIR
}
/build-server-
${
TYPE
}
/core/general-server/serving
unsetproxy
case
$TYPE
in
CPU
)
# fit_a_line (general, asyn_predict, batch_predict)
cd
../../python/examples/grpc_impl_example/fit_a_line
# pwd: /Serving/python/examples/grpc_impl_example/fit_a_line
sh get_data.sh
check_cmd
"python -m paddle_serving_server.serve --model uci_housing_model --port 9393 --thread 4 --use_multilang > /dev/null &"
sleep
5
# wait for the server to start
cd
../../../java/examples
# /Serving/java/examples
java
-cp
target/paddle-serving-sdk-java-examples-0.0.1-jar-with-dependencies.jar PaddleServingClientExample fit_a_line
java
-cp
target/paddle-serving-sdk-java-examples-0.0.1-jar-with-dependencies.jar PaddleServingClientExample asyn_predict
java
-cp
target/paddle-serving-sdk-java-examples-0.0.1-jar-with-dependencies.jar PaddleServingClientExample batch_predict
kill_server_process
# imdb (model_ensemble)
cd
../../python/examples/grpc_impl_example/imdb
# pwd: /Serving/python/examples/grpc_impl_example/imdb
sh get_data.sh
check_cmd
"python test_multilang_ensemble_server.py > /dev/null &"
sleep
5
# wait for the server to start
cd
../../../java/examples
# /Serving/java/examples
java
-cp
target/paddle-serving-sdk-java-examples-0.0.1-jar-with-dependencies.jar PaddleServingClientExample model_ensemble
kill_server_process
# yolov4 (int32)
cd
../../python/examples/grpc_impl_example/yolov4
# pwd: /Serving/python/examples/grpc_impl_example/yolov4
python
-m
paddle_serving_app.package
--get_model
yolov4
tar
-xzvf
yolov4.tar.gz
check_cmd
"python -m paddle_serving_server.serve --model yolov4_model --port 9393 --use_multilang > /dev/null &"
cd
../../../java/examples
# /Serving/java/examples
java
-cp
target/paddle-serving-sdk-java-examples-0.0.1-jar-with-dependencies.jar PaddleServingClientExample yolov4 src/main/resources/000000570688.jpg
kill_server_process
# cube (load server config and client config in Server side)
cd
../../python/examples/grpc_impl_example/criteo_ctr_with_cube
# pwd: /Serving/python/examples/grpc_impl_example/criteo_ctr_with_cube
check_cmd
"wget https://paddle-serving.bj.bcebos.com/unittest/ctr_cube_unittest.tar.gz"
check_cmd
"tar xf ctr_cube_unittest.tar.gz"
check_cmd
"mv models/ctr_client_conf ./"
check_cmd
"mv models/ctr_serving_model_kv ./"
check_cmd
"mv models/data ./cube/"
check_cmd
"mv models/ut_data ./"
cp
../../../../build-server-
$TYPE
/output/bin/cube
*
./cube/
sh cube_prepare.sh &
check_cmd
"mkdir work_dir1 && cp cube/conf/cube.conf ./work_dir1/"
python test_server.py ctr_serving_model_kv ctr_client_conf/serving_client_conf.prototxt &
sleep
5
cd
../../../java/examples
# /Serving/java/examples
java
-cp
target/paddle-serving-sdk-java-examples-0.0.1-jar-with-dependencies.jar PaddleServingClientExample cube_local
kill_server_process
ps
-ef
|
grep
"test_server"
|
grep
-v
serving_build |
grep
-v
grep
|
awk
'{print $2}'
| xargs
kill
ps
-ef
|
grep
"cube"
|
grep
-v
grep
|
awk
'{print $2}'
| xargs
kill
;;
GPU
)
;;
*
)
echo
"error type"
exit
1
;;
esac
echo
"java-sdk
$TYPE
part finished as expected."
setproxy
unset
SERVING_BIN
cd
../../
# pwd: /Serving
}
function
python_test_grpc_impl
()
{
# pwd: /Serving/python/examples
cd
grpc_impl_example
# pwd: /Serving/python/examples/grpc_impl_example
...
...
@@ -979,6 +1057,7 @@ function main() {
build_server
$TYPE
# pwd: /Serving
build_app
$TYPE
# pwd: /Serving
python_run_test
$TYPE
# pwd: /Serving
java_run_test
$TYPE
# pwd: /Serving
monitor_test
$TYPE
# pwd: /Serving
echo
"serving
$TYPE
part finished as expected."
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录