Shows the recently added warning when WaitUntilIdle is called with source nodes only once. Otherwise, it is very spammy as it's shown every frame. Moreover, display the names of the sources, so the warning is more actionable.

PiperOrigin-RevId: 543676454
This commit is contained in:
MediaPipe Team 2023-06-27 01:59:59 -07:00 committed by Copybara-Service
parent c8c5f3d062
commit bed624f3b6
2 changed files with 18 additions and 2 deletions

View File

@ -840,9 +840,12 @@ absl::Status CalculatorGraph::PrepareForRun(
absl::Status CalculatorGraph::WaitUntilIdle() { absl::Status CalculatorGraph::WaitUntilIdle() {
if (has_sources_) { if (has_sources_) {
LOG(WARNING) << "WaitUntilIdle called on a graph with source nodes, which " LOG_FIRST_N(WARNING, 1)
"is not fully supported at the moment."; << "WaitUntilIdle called on a graph with source nodes, which "
"is not fully supported at the moment. Source nodes: "
<< ListSourceNodes();
} }
MP_RETURN_IF_ERROR(scheduler_.WaitUntilIdle()); MP_RETURN_IF_ERROR(scheduler_.WaitUntilIdle());
VLOG(2) << "Scheduler idle."; VLOG(2) << "Scheduler idle.";
absl::Status status = absl::OkStatus(); absl::Status status = absl::OkStatus();
@ -1372,6 +1375,16 @@ const OutputStreamManager* CalculatorGraph::FindOutputStreamManager(
.get()[validated_graph_->OutputStreamIndex(name)]; .get()[validated_graph_->OutputStreamIndex(name)];
} }
std::string CalculatorGraph::ListSourceNodes() const {
std::vector<std::string> sources;
for (auto& node : nodes_) {
if (node->IsSource()) {
sources.push_back(node->DebugName());
}
}
return absl::StrJoin(sources, ", ");
}
namespace { namespace {
void PrintTimingToInfo(const std::string& label, int64_t timer_value) { void PrintTimingToInfo(const std::string& label, int64_t timer_value) {
const int64_t total_seconds = timer_value / 1000000ll; const int64_t total_seconds = timer_value / 1000000ll;

View File

@ -597,6 +597,9 @@ class CalculatorGraph {
// status before taking any action. // status before taking any action.
void UpdateThrottledNodes(InputStreamManager* stream, bool* stream_was_full); void UpdateThrottledNodes(InputStreamManager* stream, bool* stream_was_full);
// Returns a comma-separated list of source nodes.
std::string ListSourceNodes() const;
#if !MEDIAPIPE_DISABLE_GPU #if !MEDIAPIPE_DISABLE_GPU
// Owns the legacy GpuSharedData if we need to create one for backwards // Owns the legacy GpuSharedData if we need to create one for backwards
// compatibility. // compatibility.