Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
188d1fc7
M
mindspore
项目概览
magicwindyyd
/
mindspore
与 Fork 源项目一致
Fork自
MindSpore / mindspore
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindspore
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
188d1fc7
编写于
7月 01, 2020
作者:
M
mindspore-ci-bot
提交者:
Gitee
7月 01, 2020
浏览文件
操作
浏览文件
下载
差异文件
!2783 fix serving exit signal handle
Merge pull request !2783 from dinghao/master
上级
f18329ea
b7667628
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
9 addition
and
12 deletion
+9
-12
serving/core/server.cc
serving/core/server.cc
+9
-12
未找到文件。
serving/core/server.cc
浏览文件 @
188d1fc7
...
...
@@ -227,6 +227,7 @@ class MSServiceImpl final : public MSService::Service {
Status
Server
::
BuildAndStart
()
{
// handle exit signal
signal
(
SIGINT
,
HandleSignal
);
signal
(
SIGTERM
,
HandleSignal
);
Status
res
;
auto
option_args
=
Options
::
Instance
().
GetArgs
();
std
::
string
server_address
=
"0.0.0.0:"
+
std
::
to_string
(
option_args
->
grpc_port
);
...
...
@@ -258,21 +259,17 @@ Status Server::BuildAndStart() {
}
g_ctx
=
ctx
;
#endif
MSServiceImpl
s
ervice
;
MSServiceImpl
msS
ervice
;
grpc
::
EnableDefaultHealthCheckService
(
true
);
grpc
::
reflection
::
InitProtoReflectionServerBuilderPlugin
();
// Set the port is not reuseable
auto
option
=
grpc
::
MakeChannelArgumentOption
(
GRPC_ARG_ALLOW_REUSEPORT
,
0
);
grpc
::
ServerBuilder
builder
;
builder
.
SetOption
(
std
::
move
(
option
));
builder
.
SetMaxMessageSize
(
uint32max
);
// Listen on the given address without any authentication mechanism.
builder
.
AddListeningPort
(
server_address
,
grpc
::
InsecureServerCredentials
());
// Register "service" as the instance through which we'll communicate with
// clients. In this case it corresponds to an *synchronous* service.
builder
.
RegisterService
(
&
service
);
// Finally assemble the server.
std
::
unique_ptr
<
grpc
::
Server
>
server
(
builder
.
BuildAndStart
());
grpc
::
ServerBuilder
serverBuilder
;
serverBuilder
.
SetOption
(
std
::
move
(
option
));
serverBuilder
.
SetMaxMessageSize
(
uint32max
);
serverBuilder
.
AddListeningPort
(
server_address
,
grpc
::
InsecureServerCredentials
());
serverBuilder
.
RegisterService
(
&
msService
);
std
::
unique_ptr
<
grpc
::
Server
>
server
(
serverBuilder
.
BuildAndStart
());
if
(
server
==
nullptr
)
{
MS_LOG
(
ERROR
)
<<
"The serving server create failed"
;
ClearEnv
();
...
...
@@ -280,7 +277,7 @@ Status Server::BuildAndStart() {
}
auto
grpc_server_run
=
[
&
server
]()
{
server
->
Wait
();
};
std
::
thread
serving_thread
(
grpc_server_run
);
MS_LOG
(
INFO
)
<<
"
Server listening on "
<<
server_address
<<
std
::
endl
;
MS_LOG
(
INFO
)
<<
"
MS Serving listening on "
<<
server_address
;
auto
exit_future
=
exit_requested
.
get_future
();
exit_future
.
wait
();
ClearEnv
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录