!841 fix for json dump

From: @ni100die
Reviewed-by: @xchu42,@ji_chen
Signed-off-by: @ji_chen
pull/841/MERGE
mindspore-ci-bot 4 years ago committed by Gitee
commit 5abfa0db30

@ -217,10 +217,15 @@ ge::Status Analyzer::SaveAnalyzerDataToFile(uint64_t session_id, uint64_t graph_
json jsn;
GraphInfoToJson(jsn, *graph_info);
json_file_ << jsn.dump(kJsonDumpLevel) << std::endl;
bool ret_failed = false;
try {
json_file_ << jsn.dump(kJsonDumpLevel) << std::endl;
} catch (nlohmann::detail::type_error &e) {
GELOGE(FAILED, "analyzer file [%s] failed because [%s]", json_file_name_.c_str(), e.what());
ret_failed = true;
}
json_file_.close();
return SUCCESS;
return ret_failed ? FAILED : SUCCESS;
}
ge::Status Analyzer::DoAnalyze(DataInfo &data_info) {

Loading…
Cancel
Save