Log stack traces for combined CalculatorGraph statuses

PiperOrigin-RevId: 553111356
This commit is contained in:
MediaPipe Team 2023-08-02 05:08:34 -07:00 committed by Copybara-Service
parent 557ed0b1ea
commit 6e54d8c204

View File

@ -75,6 +75,11 @@ namespace {
constexpr int kMaxNumAccumulatedErrors = 1000;
constexpr char kApplicationThreadExecutorType[] = "ApplicationThreadExecutor";
// Do not log status payloads, but do include stack traces.
constexpr absl::StatusToStringMode kStatusLogFlags =
absl::StatusToStringMode::kWithEverything &
(~absl::StatusToStringMode::kWithPayload);
} // namespace
void CalculatorGraph::ScheduleAllOpenableNodes() {
@ -707,7 +712,7 @@ absl::Status CalculatorGraph::PrepareForRun(
absl::Status error_status;
if (has_error_) {
GetCombinedErrors(&error_status);
LOG(ERROR) << error_status;
LOG(ERROR) << error_status.ToString(kStatusLogFlags);
return error_status;
}
@ -786,7 +791,7 @@ absl::Status CalculatorGraph::PrepareForRun(
}
if (GetCombinedErrors(&error_status)) {
LOG(ERROR) << error_status;
LOG(ERROR) << error_status.ToString(kStatusLogFlags);
CleanupAfterRun(&error_status);
return error_status;
}
@ -850,7 +855,7 @@ absl::Status CalculatorGraph::WaitUntilIdle() {
VLOG(2) << "Scheduler idle.";
absl::Status status = absl::OkStatus();
if (GetCombinedErrors(&status)) {
LOG(ERROR) << status;
LOG(ERROR) << status.ToString(kStatusLogFlags);
}
return status;
}
@ -1052,8 +1057,7 @@ void CalculatorGraph::RecordError(const absl::Status& error) {
}
bool CalculatorGraph::GetCombinedErrors(absl::Status* error_status) {
return GetCombinedErrors("CalculatorGraph::Run() failed in Run: ",
error_status);
return GetCombinedErrors("CalculatorGraph::Run() failed: ", error_status);
}
bool CalculatorGraph::GetCombinedErrors(const std::string& error_prefix,