Skip to content

Commit a0cd2ee

Browse files
kenfrankotensorflow-copybara
authored andcommitted
Add WaitResponses to PredictStreamedContext Method.
* Adds an optional method that will wait for all responses to be generated before returning for streaming responses. PiperOrigin-RevId: 691069391
1 parent 4acb832 commit a0cd2ee

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

tensorflow_serving/servables/tensorflow/mock_servable.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ class MockPredictStreamedContext : public PredictStreamedContext {
3737
MOCK_METHOD(absl::Status, ProcessRequest, (const PredictRequest& request),
3838
(final));
3939
MOCK_METHOD(absl::Status, Close, (), (final));
40+
MOCK_METHOD(absl::Status, WaitResponses, (), (final));
4041
};
4142

4243
// A mock of tensorflow::serving::Servable.

tensorflow_serving/servables/tensorflow/servable.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,9 @@ absl::Status SingleRequestPredictStreamedContext::Close() {
6161
return absl::OkStatus();
6262
}
6363

64+
absl::Status SingleRequestPredictStreamedContext::WaitResponses() {
65+
return absl::OkStatus();
66+
}
67+
6468
} // namespace serving
6569
} // namespace tensorflow

tensorflow_serving/servables/tensorflow/servable.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ class PredictStreamedContext {
5454

5555
// Closes the `PredictStreamed` session.
5656
virtual absl::Status Close() = 0;
57+
58+
// Waits for all of the responses to be generated
59+
virtual absl::Status WaitResponses() = 0;
5760
};
5861

5962
// A convenience wrapper for cases where the implementation allows exactly one
@@ -69,6 +72,7 @@ class SingleRequestPredictStreamedContext final
6972

7073
absl::Status ProcessRequest(const PredictRequest& request) final;
7174
absl::Status Close() final;
75+
absl::Status WaitResponses() final;
7276

7377
private:
7478
absl::AnyInvocable<absl::Status(const PredictRequest&)> f_;

0 commit comments

Comments
 (0)