!19278 Fix dataset log error that dataset doesn't print error log under some scenarios

Merge pull request !19278 from xiefangqi/md_fix_log_print
This commit is contained in:
i-robot 2021-07-07 01:58:10 +00:00 committed by Gitee
commit add3745e39
2 changed files with 4 additions and 3 deletions

View File

@ -568,8 +568,8 @@ Status DeviceQueueOp::MallocForGPUData(std::vector<device::DataItemGpu> *items,
const int32_t &worker_id) {
int i = 0;
for (auto &sub_item : *items) {
RETURN_IF_NOT_OK(pool_[worker_id]->Allocate(sub_item.data_len_, &sub_item.data_ptr_));
if (sub_item.data_ptr_ == nullptr) {
auto rc = pool_[worker_id]->Allocate(sub_item.data_len_, &sub_item.data_ptr_);
if (rc.IsError() || sub_item.data_ptr_ == nullptr) {
return Status(StatusCode::kMDOutOfMemory, __LINE__, __FILE__, "Memory malloc failed.");
}
if (curr_row[i] == nullptr) {

View File

@ -213,6 +213,8 @@ void TaskManager::InterruptMaster(const Status &rc) {
if (rc.IsError() && master->rc_.IsOk()) {
master->rc_ = rc;
master->caught_severe_exception_ = true;
// Move log error here for some scenarios didn't call GetMasterThreadRc
MS_LOG(ERROR) << "Task is terminated with err msg(more detail in info level log):" << master->rc_;
}
}
@ -223,7 +225,6 @@ Status TaskManager::GetMasterThreadRc() {
if (rc.IsError()) {
// Reset the state once we retrieve the value.
std::lock_guard<std::mutex> lck(master->mux_);
MS_LOG(ERROR) << "Task is terminated with err msg(more detail in info level log):" << master->rc_;
master->rc_ = Status::OK();
master->caught_severe_exception_ = false;
master->ResetIntrpState();