Project import generated by Copybara.

GitOrigin-RevId: d073f8e21be2fcc0e503cb97c6695078b6b75310
This commit is contained in:
MediaPipe Team
2021-02-27 03:30:05 -05:00
committed by chuoling
parent 39309bedba
commit 350fbb2100
755 changed files with 16391 additions and 11075 deletions
+11 -12
View File
@@ -83,8 +83,8 @@ void Scheduler::SetExecutor(Executor* executor) {
}
// TODO: Consider renaming this method CreateNonDefaultQueue.
mediapipe::Status Scheduler::SetNonDefaultExecutor(const std::string& name,
Executor* executor) {
absl::Status Scheduler::SetNonDefaultExecutor(const std::string& name,
Executor* executor) {
RET_CHECK_EQ(state_, STATE_NOT_STARTED) << "SetNonDefaultExecutor must not "
"be called after the scheduler "
"has started";
@@ -99,7 +99,7 @@ mediapipe::Status Scheduler::SetNonDefaultExecutor(const std::string& name,
std::placeholders::_1));
queue->SetExecutor(executor);
scheduler_queues_.push_back(queue);
return mediapipe::OkStatus();
return absl::OkStatus();
}
void Scheduler::SetQueuesRunning(bool running) {
@@ -252,7 +252,7 @@ void Scheduler::EmittedObservedOutput() {
}
}
mediapipe::Status Scheduler::WaitForObservedOutput() {
absl::Status Scheduler::WaitForObservedOutput() {
bool observed = false;
ApplicationThreadAwait(
[this, &observed]() ABSL_EXCLUSIVE_LOCKS_REQUIRED(state_mutex_) {
@@ -262,8 +262,7 @@ mediapipe::Status Scheduler::WaitForObservedOutput() {
// Wait until the member waiting_for_observed_output_ becomes false.
return !waiting_for_observed_output_;
});
return observed ? mediapipe::OkStatus()
: mediapipe::OutOfRangeError("Graph is done.");
return observed ? absl::OkStatus() : absl::OutOfRangeError("Graph is done.");
}
// Idleness requires:
@@ -273,18 +272,18 @@ mediapipe::Status Scheduler::WaitForObservedOutput() {
// no source nodes. (This is enforced by CalculatorGraph::WaitUntilIdle().)
// The application must ensure no other threads are adding packets to graph
// input streams while a WaitUntilIdle() call is in progress.
mediapipe::Status Scheduler::WaitUntilIdle() {
absl::Status Scheduler::WaitUntilIdle() {
RET_CHECK_NE(state_, STATE_NOT_STARTED);
ApplicationThreadAwait(std::bind(&Scheduler::IsIdle, this));
return mediapipe::OkStatus();
return absl::OkStatus();
}
mediapipe::Status Scheduler::WaitUntilDone() {
absl::Status Scheduler::WaitUntilDone() {
RET_CHECK_NE(state_, STATE_NOT_STARTED);
ApplicationThreadAwait([this]() ABSL_EXCLUSIVE_LOCKS_REQUIRED(state_mutex_) {
return state_ == STATE_TERMINATED;
});
return mediapipe::OkStatus();
return absl::OkStatus();
}
void Scheduler::ApplicationThreadAwait(
@@ -379,7 +378,7 @@ bool Scheduler::TryToScheduleNextSourceLayer() {
// If no graph input streams are open, then there are no packet sources in
// the graph. It's a deadlock.
if (graph_input_streams_closed_) {
graph_->RecordError(mediapipe::UnknownError(
graph_->RecordError(absl::UnknownError(
"Detected a deadlock because source nodes cannot be activated when a "
"source node at a lower layer is still not opened."));
}
@@ -496,7 +495,7 @@ void Scheduler::Cancel() {
if (state_ != STATE_RUNNING && state_ != STATE_PAUSED) {
return;
}
graph_->RecordError(mediapipe::CancelledError());
graph_->RecordError(absl::CancelledError());
if (state_ == STATE_PAUSED) {
// Keep the scheduler queue running, since we need to exhaust it.
SetQueuesRunning(true);