From 086309d1e9140db26fa0d725982810c9f67bd8a1 Mon Sep 17 00:00:00 2001 From: "wangwenhua1@huawei.com" Date: Sat, 14 Nov 2020 17:11:55 +0800 Subject: [PATCH] error message add --- ge/graph/preprocess/insert_op/ge_aipp_op.cc | 23 +++++++++------------- .../preprocess/insert_op/util_insert_aipp_op.cc | 21 +++++--------------- 2 files changed, 14 insertions(+), 30 deletions(-) diff --git a/ge/graph/preprocess/insert_op/ge_aipp_op.cc b/ge/graph/preprocess/insert_op/ge_aipp_op.cc index e6b30639..e7c1fce7 100755 --- a/ge/graph/preprocess/insert_op/ge_aipp_op.cc +++ b/ge/graph/preprocess/insert_op/ge_aipp_op.cc @@ -306,9 +306,8 @@ NodePtr AippOp::FindDataByIndex(const ComputeGraphPtr &graph, int rank) { } return node; } - GELOGE(PARAM_INVALID, "Can not find the data node by index %d", rank); string errormsg = "Can not find the data node by aipp parameter related_input_rank " + to_string(rank); - ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {errormsg}); + GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error_msg); return nullptr; } Status AippOp::GetAndCheckTarget(const ComputeGraphPtr &graph, int rank, NodePtr &target, @@ -353,10 +352,10 @@ Status AippOp::GetAndCheckTarget(const ComputeGraphPtr &graph, int rank, NodePtr } if (!edge_indexes.empty() && (*edge_indexes.rbegin() >= data_node->GetOutDataNodes().size())) { - GELOGE(PARAM_INVALID, "input_edge_idx %u should smaller than out edge size of target input %zu", - *edge_indexes.rbegin(), data_node->GetOutDataNodes().size()); - string errormsg = "The aipp parameter input_edge_idx should be smaller than the target input's outnodes."; - ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {errormsg}); + string errormsg = "The aipp parameter input_edge_idx[" + std::to_string(*edge_indexes.rbegin()) + + "] should be smaller than the target input[" + + std::to_string(data_node->GetOutDataNodes().size()) +"]'s outnodes."; + GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error_msg); return PARAM_INVALID; } target = data_node; @@ -429,8 +428,7 @@ Status AippOp::ConvertRelatedInputNameToRank() { if (!convert_flag) { string error_msg = "Top name " + related_input_name + "convert rank failed, Please" " ensure top name in aipp config is the top name of data node."; - ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {error_msg}); - GELOGE(PARAM_INVALID, "Top name[%s] converts rank failed.", related_input_name.c_str()); + GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error_msg); return PARAM_INVALID; } @@ -781,22 +779,19 @@ Status AippOp::CreateAippData(const NodePtr &aipp_node) { int64_t batch_count = -1; if (GetDataDimN(data_node, ori_data_format, batch_count) != ge::SUCCESS) { string errormsg = "Get data_node dims and transfer to nchw_dims failed!"; - ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {errormsg}); - GELOGE(PARAM_INVALID, "Get data_node dims and transfer to nchw_dims failed!"); + GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, errormsg); return PARAM_INVALID; } if (batch_count <= 0) { string errormsg = "Batch count[" + std::to_string(batch_count) + "] is invalid, it must positive."; - ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {errormsg}); - GELOGE(PARAM_INVALID, "Batch count %ld is invalid", batch_count); + GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, errormsg); return PARAM_INVALID; } int64_t max_dynamic_aipp_size = CalcMaxSize(batch_count); if (max_dynamic_aipp_size < 0) { string errormsg = "The dynamic aipp size is not positive"; - ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {errormsg}); - GELOGE(PARAM_INVALID, "The dynamic aipp size is not positive."); + GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, errormsg); return PARAM_INVALID; } diff --git a/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc b/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc index 6a2eb333..923f0604 100755 --- a/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc +++ b/ge/graph/preprocess/insert_op/util_insert_aipp_op.cc @@ -130,10 +130,7 @@ Status InsertNewOpUtil::CheckInputNamePositionNotRepeat() { if (item->related_input_name() == another_item->related_input_name()) { string error_msg = "Can not insert aipp to the same postion! Please ensure related_input_name" " param is different in different aipp config."; - ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {error_msg}); - GELOGE(PARAM_INVALID, - "Can not insert aipp op to the same postion! Please ensure related_input_rank param " - "is different in different aipp config."); + GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error_msg); return PARAM_INVALID; } } @@ -153,19 +150,13 @@ Status InsertNewOpUtil::CheckInputRankPositionNoRepeat() { if (!another_item->related_input_name().empty()) { string error_msg = "Can not both set related_input_rank and related_input_name!" " Please ensure param is the same with the first aipp config(related_input_rank)."; - ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {error_msg}); - GELOGE(PARAM_INVALID, - "Can not both set related_input_rank and related_input_name!" - " Please ensure param is the same with the first aipp config(related_input_rank)."); + GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error_msg); return PARAM_INVALID; } if (item->related_input_rank() == another_item->related_input_rank()) { string error_msg = "Can not insert aipp to the same postion! Please ensure related_input_rank" " param is different in different aipp config."; - ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {error_msg}); - GELOGE(PARAM_INVALID, - "Can not insert aipp op to the same postion! Please ensure related_input_rank param " - "is different in different aipp config."); + GE_ERRORLOG_AND_ERRORMSG(PARAM_INVALID, error_msg); return PARAM_INVALID; } } @@ -292,8 +283,7 @@ Status InsertNewOpUtil::UpdateDataNodeByAipp(const ComputeGraphPtr &graph) { auto data_iter = switchn_names_to_data.find(switchn->GetName()); if (data_iter == switchn_names_to_data.end()) { string errormsg = "Failed to find relative data node by switchn[" + switchn->GetName() + "]"; - ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {errormsg}); - GELOGE(INTERNAL_ERROR, "Failed to find relative data node by switchn %s", switchn->GetName().c_str()); + GE_ERRORLOG_AND_ERRORMSG(INTERNAL_ERROR, errormsg); return INTERNAL_ERROR; } GE_RETURN_IF_ERROR(UpdateDataBySwitchN(switchn, data_iter->second)); @@ -481,8 +471,7 @@ Status InsertNewOpUtil::UpdateDataBySwitchN(const NodePtr &switchn, const NodePt } if (max_index >= switchn->GetOpDesc()->GetOutputsSize()) { string errormsg = "No max size found from switchn node[" + switchn->GetName()+ "]"; - ErrorManager::GetInstance().ATCReportErrMessage("E10043", {"reason"}, {errormsg}); - GELOGE(INTERNAL_ERROR, "No max size found from switchn node %s", switchn->GetName().c_str()); + GE_ERRORLOG_AND_ERRORMSG(INTERNAL_ERROR, errormsg); return INTERNAL_ERROR; } auto output_desc = switchn->GetOpDesc()->MutableOutputDesc(max_index);