Internal change

PiperOrigin-RevId: 539220863
This commit is contained in:
MediaPipe Team 2023-06-09 18:04:35 -07:00 committed by Copybara-Service
parent 53f0736bf0
commit 1d4a205c2e
3 changed files with 9 additions and 2 deletions

View File

@ -839,6 +839,10 @@ absl::Status CalculatorGraph::PrepareForRun(
} }
absl::Status CalculatorGraph::WaitUntilIdle() { absl::Status CalculatorGraph::WaitUntilIdle() {
if (has_sources_) {
LOG(WARNING) << "WaitUntilIdle called on a graph with source nodes, which "
"is not fully supported at the moment.";
}
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();

View File

@ -229,8 +229,11 @@ class CalculatorGraph {
// Wait until the running graph is in the idle mode, which is when nothing can // Wait until the running graph is in the idle mode, which is when nothing can
// be scheduled and nothing is running in the worker threads. This function // be scheduled and nothing is running in the worker threads. This function
// can be called only after StartRun(). // can be called only after StartRun().
//
// NOTE: The graph must not have any source nodes because source nodes prevent // NOTE: The graph must not have any source nodes because source nodes prevent
// the running graph from becoming idle until the source nodes are done. // the running graph from becoming idle until the source nodes are done.
// Currently, `WaitUntilIdle` cannot be used reliably on graphs with any
// source nodes.
absl::Status WaitUntilIdle(); absl::Status WaitUntilIdle();
// Wait until a packet is emitted on one of the observed output streams. // Wait until a packet is emitted on one of the observed output streams.

View File

@ -273,8 +273,8 @@ absl::Status Scheduler::WaitForObservedOutput() {
// Idleness requires: // Idleness requires:
// 1. either the graph has no source nodes or all source nodes are closed, and // 1. either the graph has no source nodes or all source nodes are closed, and
// 2. no packets are added to graph input streams. // 2. no packets are added to graph input streams.
// For simplicity, we only allow WaitUntilIdle() to be called on a graph with // For simplicity, we only fully support WaitUntilIdle() to be called on a graph
// no source nodes. (This is enforced by CalculatorGraph::WaitUntilIdle().) // with no source nodes.
// The application must ensure no other threads are adding packets to graph // The application must ensure no other threads are adding packets to graph
// input streams while a WaitUntilIdle() call is in progress. // input streams while a WaitUntilIdle() call is in progress.
absl::Status Scheduler::WaitUntilIdle() { absl::Status Scheduler::WaitUntilIdle() {