!26648 add more log to locate op compile failed reason

Merge pull request !26648 from liubuyu/SB
This commit is contained in:
i-robot 2021-11-24 01:15:48 +00:00 committed by Gitee
commit b1d878ca6b
1 changed files with 10 additions and 13 deletions

View File

@ -147,23 +147,20 @@ void PrintInfo(const nlohmann::json &info, const std::string &job_name, const in
}
std::string FilterExceptionMessage(const std::vector<nlohmann::json> &all_logs) {
std::ostringstream buffer;
std::ostringstream exception_buffer;
// print all logs if exception log is empty
std::ostringstream all_message_buffer;
for (const auto &item : all_logs) {
auto message = GetJsonValue<std::string>(item, kMessage);
if (message.find("except_msg") != std::string::npos) {
buffer << message;
buffer << "\n";
}
if (message.find("except_tuple_msg") != std::string::npos) {
buffer << message;
buffer << "\n";
}
if (message.find("Error message") != std::string::npos) {
buffer << message;
buffer << "\n";
all_message_buffer << message;
all_message_buffer << "\n";
if (message.find("except_msg") != std::string::npos || message.find("except_tuple_msg") != std::string::npos ||
message.find("Error message") != std::string::npos) {
exception_buffer << message;
exception_buffer << "\n";
}
}
auto res = buffer.str().empty() ? "None" : buffer.str();
auto res = exception_buffer.str().empty() ? all_message_buffer.str() : exception_buffer.str();
return res;
}