Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
magicwindyyd
mindspore
提交
83b7976d
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看板
提交
83b7976d
编写于
4年前
作者:
Z
Zhang Qinghua
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix the kernel build server quit issue.
上级
4d963d96
master
无相关合并请求
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
19 addition
and
14 deletion
+19
-14
mindspore/ccsrc/backend/session/kernel_build_client.h
mindspore/ccsrc/backend/session/kernel_build_client.h
+2
-1
mindspore/ccsrc/common/duplex_pipe.cc
mindspore/ccsrc/common/duplex_pipe.cc
+4
-4
mindspore/ccsrc/common/duplex_pipe.h
mindspore/ccsrc/common/duplex_pipe.h
+13
-9
未找到文件。
mindspore/ccsrc/backend/session/kernel_build_client.h
浏览文件 @
83b7976d
...
...
@@ -59,7 +59,8 @@ class KernelBuildClient {
// Exception's thrown if open failed
if
(
dp_
->
Open
({
GetEnv
(),
GetScript
()},
true
)
!=
-
1
)
{
dp_
->
SetTimeOutSeconds
(
kTimeOutSeconds
);
dp_
->
SetTimeOutCallback
([
this
]()
{
SendRequest
(
kFinish
);
});
dp_
->
SetTimeOutCallback
(
std
::
make_shared
<
std
::
function
<
void
()
>>
([
this
]()
{
SendRequest
(
kFinish
);
}));
dp_
->
SetFinalizeCallback
(
std
::
make_shared
<
std
::
function
<
void
()
>>
([
this
]()
{
Close
();
}));
init_
=
true
;
}
}
...
...
This diff is collapsed.
Click to expand it.
mindspore/ccsrc/common/duplex_pipe.cc
浏览文件 @
83b7976d
...
...
@@ -168,7 +168,7 @@ void DuplexPipe::SignalHandler::CancelAlarm() { alarm(0); }
void
DuplexPipe
::
SignalHandler
::
SigAlarmHandler
(
int
sig
)
{
DP_INFO
<<
"Signal: "
<<
sig
<<
", child_pid_: "
<<
child_pid_
;
if
(
!
dp_
.
expired
())
{
dp_
.
lock
()
->
TimeOut
();
dp_
.
lock
()
->
Notify
TimeOut
();
}
}
...
...
@@ -184,9 +184,9 @@ void DuplexPipe::SignalHandler::SigChildHandler(int sig) {
int
status
;
auto
pid
=
waitpid
(
child_pid_
,
&
status
,
WNOHANG
|
WUNTRACED
);
if
(
WIFEXITED
(
status
))
{
DP_INFO
<<
"Child exited, status: "
<<
WEXITSTATUS
(
status
)
<<
", pid: "
<<
pid
;
if
(
!
dp_
.
expired
())
{
dp_
.
lock
()
->
Clos
e
();
DP_INFO
<<
"Child exited, status: "
<<
WEXITSTATUS
(
status
)
<<
", pid: "
<<
pid
<<
", dp expired: "
<<
dp_
.
expired
()
;
if
(
pid
>
0
&&
!
dp_
.
expired
())
{
dp_
.
lock
()
->
NotifyFinaliz
e
();
}
}
else
if
(
WIFSTOPPED
(
status
))
{
DP_INFO
<<
"Child stopped, sig: "
<<
WSTOPSIG
(
status
)
<<
", pid: "
<<
pid
;
...
...
This diff is collapsed.
Click to expand it.
mindspore/ccsrc/common/duplex_pipe.h
浏览文件 @
83b7976d
...
...
@@ -45,10 +45,8 @@ class DuplexPipe : public std::enable_shared_from_this<mindspore::DuplexPipe> {
int
Open
(
std
::
initializer_list
<
std
::
string
>
arg_list
,
bool
append_fds
=
false
);
void
Close
();
void
SetTimeOutSeconds
(
unsigned
int
secs
)
{
time_out_secs_
=
secs
;
}
void
SetTimeOutCallback
(
const
std
::
function
<
void
()
>
&
cb
)
{
has_time_out_callback_
=
true
;
time_out_callback_
=
cb
;
}
void
SetTimeOutCallback
(
const
std
::
shared_ptr
<
std
::
function
<
void
()
>>
cb
)
{
time_out_callback_
=
cb
;
}
void
SetFinalizeCallback
(
const
std
::
shared_ptr
<
std
::
function
<
void
()
>>
cb
)
{
finalize_callback_
=
cb
;
}
// Write the 'buf' to remote stdin
void
Write
(
const
std
::
string
&
buf
,
bool
flush
=
true
);
...
...
@@ -64,14 +62,20 @@ class DuplexPipe : public std::enable_shared_from_this<mindspore::DuplexPipe> {
private:
void
SetTimeOut
()
{
signal_handler_
->
SetAlarm
(
time_out_secs_
);
}
void
CancelTimeOut
()
{
signal_handler_
->
CancelAlarm
();
}
void
TimeOut
()
{
if
(
has_time_out_callback_
)
{
time_out_callback_
();
void
Notify
TimeOut
()
{
if
(
time_out_callback_
!=
nullptr
)
{
(
*
time_out_callback_
)
();
}
Close
();
DP_EXCEPTION
<<
"Time out when read from pipe"
;
}
void
NotifyFinalize
()
{
if
(
finalize_callback_
!=
nullptr
)
{
(
*
finalize_callback_
)();
}
}
// Subprocess id in parent process,
// otherwise zero in child process.
pid_t
pid_
;
...
...
@@ -115,8 +119,8 @@ class DuplexPipe : public std::enable_shared_from_this<mindspore::DuplexPipe> {
};
unsigned
int
time_out_secs_
=
kTimeOutSeconds
;
bool
has_time_out_callback_
=
false
;
std
::
function
<
void
()
>
time_out
_callback_
;
std
::
shared_ptr
<
std
::
function
<
void
()
>>
time_out_callback_
;
std
::
shared_ptr
<
std
::
function
<
void
()
>>
finalize
_callback_
;
std
::
shared_ptr
<
SignalHandler
>
signal_handler_
;
};
}
// namespace mindspore
...
...
This diff is collapsed.
Click to expand it.
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录