!6154 Remove the timeout function in kernel build client.

Merge pull request !6154 from 张清华/master2
pull/6154/MERGE
mindspore-ci-bot 5 years ago committed by Gitee
commit 759876f5bf

@ -58,8 +58,6 @@ class KernelBuildClient {
if (!init_) {
// Exception's thrown if open failed
if (dp_->Open({GetEnv(), GetScript()}, true) != -1) {
dp_->SetTimeOutSeconds(kTimeOutSeconds);
dp_->SetTimeOutCallback(std::make_shared<std::function<void()>>([this]() { Close(); }));
dp_->SetFinalizeCallback(std::make_shared<std::function<void()>>([this]() { Close(); }));
init_ = true;
}

@ -152,7 +152,7 @@ void DuplexPipe::Close() {
DuplexPipe::SignalHandler::SignalHandler(std::shared_ptr<DuplexPipe> dp, pid_t pid) {
dp_ = dp;
child_pid_ = pid;
signal(SIGCHLD, SigChildHandler);
signal(SIGCHLD, SIG_IGN);
signal(SIGPIPE, SigPipeHandler);
}
@ -178,16 +178,4 @@ void DuplexPipe::SignalHandler::SigPipeHandler(int sig) {
dp_->NotifyFinalize();
}
}
void DuplexPipe::SignalHandler::SigChildHandler(int sig) {
DP_INFO << "Signal: " << sig << ", child_pid_: " << child_pid_;
int status;
auto pid = waitpid(child_pid_, &status, WNOHANG | WUNTRACED);
if (WIFEXITED(status)) { // Normal exit
DP_INFO << "Child exited, status: " << WEXITSTATUS(status) << ", pid: " << pid << ", dp: " << dp_;
if (pid > 0 && dp_ != nullptr) { // It's child_pid_
dp_->NotifyFinalize();
}
}
}
} // namespace mindspore

@ -61,12 +61,12 @@ class DuplexPipe : public std::enable_shared_from_this<mindspore::DuplexPipe> {
private:
void SetTimeOut() {
if (signal_handler_ != nullptr) {
if (time_out_callback_ != nullptr && signal_handler_ != nullptr) {
signal_handler_->SetAlarm(time_out_secs_);
}
}
void CancelTimeOut() {
if (signal_handler_ != nullptr) {
if (time_out_callback_ != nullptr && signal_handler_ != nullptr) {
signal_handler_->CancelAlarm();
}
}
@ -118,7 +118,6 @@ class DuplexPipe : public std::enable_shared_from_this<mindspore::DuplexPipe> {
private:
static void SigAlarmHandler(int sig);
static void SigPipeHandler(int sig);
static void SigChildHandler(int sig);
inline static std::shared_ptr<DuplexPipe> dp_;
inline static pid_t child_pid_;

Loading…
Cancel
Save