Skip to content

Commit ea320f0

Browse files
Automated Code Change
PiperOrigin-RevId: 787388243
1 parent f7f622f commit ea320f0

12 files changed

+245
-220
lines changed

tensorflow_serving/core/aspired_versions_manager_benchmark.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ void BenchmarkState::StartServing(const int64_t loader_version) {
125125
[loader_version](std::unique_ptr<int64_t>* const servable) {
126126
servable->reset(new int64_t);
127127
**servable = loader_version;
128-
return OkStatus();
128+
return absl::OkStatus();
129129
},
130130
SimpleLoader<int64_t>::EstimateNoResources()));
131131
std::vector<ServableData<std::unique_ptr<Loader>>> versions;
@@ -147,7 +147,7 @@ void BenchmarkState::StartServing(const int64_t loader_version) {
147147

148148
int64_t BenchmarkState::GetLatestVersion(const bool do_work) {
149149
ServableHandle<int64_t> handle;
150-
const Status status = manager_->GetServableHandle(
150+
const absl::Status status = manager_->GetServableHandle(
151151
ServableRequest::Latest(kServableName), &handle);
152152
TF_CHECK_OK(status) << status;
153153
if (do_work) {
@@ -335,7 +335,7 @@ void BM_GetServableHandle(::testing::benchmark::State& state) {
335335
[j](std::unique_ptr<int64_t>* const servable) {
336336
servable->reset(new int64_t);
337337
**servable = j;
338-
return OkStatus();
338+
return absl::OkStatus();
339339
},
340340
SimpleLoader<int64_t>::EstimateNoResources()));
341341
versions.push_back({{servable_name, j}, std::move(loader)});
@@ -378,7 +378,7 @@ void BM_GetServableHandle(::testing::benchmark::State& state) {
378378
ServableHandle<int64_t> handle;
379379
int i = 0;
380380
for (auto s : state) {
381-
const Status status =
381+
const absl::Status status =
382382
manager->GetServableHandle(requests->at(i % kNumRequests), &handle);
383383
TF_CHECK_OK(status) << status;
384384
++i;

tensorflow_serving/core/aspired_versions_manager_builder.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ limitations under the License.
2323
namespace tensorflow {
2424
namespace serving {
2525

26-
Status AspiredVersionsManagerBuilder::Create(
26+
absl::Status AspiredVersionsManagerBuilder::Create(
2727
Options options, std::unique_ptr<AspiredVersionsManagerBuilder>* builder) {
2828
std::unique_ptr<AspiredVersionsManager> aspired_versions_manager;
2929
TF_RETURN_IF_ERROR(AspiredVersionsManager::Create(std::move(options),

tensorflow_serving/core/basic_manager_test.cc

Lines changed: 149 additions & 140 deletions
Large diffs are not rendered by default.

tensorflow_serving/core/caching_manager.cc

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ limitations under the License.
3232
namespace tensorflow {
3333
namespace serving {
3434

35-
Status CachingManager::Create(
35+
absl::Status CachingManager::Create(
3636
Options options, std::unique_ptr<LoaderFactory> loader_factory,
3737
std::unique_ptr<CachingManager>* caching_manager) {
3838
// Set up basic manager options from the caching manager options.
@@ -53,7 +53,7 @@ Status CachingManager::Create(
5353

5454
caching_manager->reset(
5555
new CachingManager(std::move(loader_factory), std::move(basic_manager)));
56-
return OkStatus();
56+
return absl::OkStatus();
5757
}
5858

5959
CachingManager::CachingManager(std::unique_ptr<LoaderFactory> loader_factory,
@@ -63,7 +63,7 @@ CachingManager::CachingManager(std::unique_ptr<LoaderFactory> loader_factory,
6363

6464
CachingManager::~CachingManager() {}
6565

66-
Status CachingManager::GetUntypedServableHandle(
66+
absl::Status CachingManager::GetUntypedServableHandle(
6767
const ServableRequest& request,
6868
std::unique_ptr<UntypedServableHandle>* const handle) {
6969
if (request.version) {
@@ -78,11 +78,11 @@ Status CachingManager::GetUntypedServableHandle(
7878
handle);
7979
}
8080

81-
Status CachingManager::GetUntypedServableHandleForId(
81+
absl::Status CachingManager::GetUntypedServableHandleForId(
8282
const ServableId& servable_id,
8383
std::unique_ptr<UntypedServableHandle>* handle) {
8484
// Check if the underlying basic manager can already serve this request.
85-
const Status handle_status = basic_manager_->GetUntypedServableHandle(
85+
const absl::Status handle_status = basic_manager_->GetUntypedServableHandle(
8686
ServableRequest::FromId(servable_id), handle);
8787

8888
// If the servable is already managed and loaded by the basic manager, serve
@@ -106,7 +106,7 @@ Status CachingManager::GetUntypedServableHandleForId(
106106
ServableRequest::FromId(servable_id), handle);
107107
}
108108

109-
Status CachingManager::LoadServable(
109+
absl::Status CachingManager::LoadServable(
110110
ServableData<std::unique_ptr<Loader>> loader_data) {
111111
const ServableId servable_id = loader_data.id();
112112

@@ -150,7 +150,7 @@ Status CachingManager::LoadServable(
150150
// the functionality of the event-bus and the servable state monitor are
151151
// automatically available in the caching-manager as well (via the basic
152152
// manager).
153-
const Status manage_status =
153+
const absl::Status manage_status =
154154
basic_manager_->ManageServable(std::move(loader_data));
155155
if (!manage_status.ok()) {
156156
const string error_msg = strings::StrCat(
@@ -161,18 +161,19 @@ Status CachingManager::LoadServable(
161161
}
162162

163163
Notification load_done;
164-
Status load_status;
165-
basic_manager_->LoadServable(servable_id, [&](const Status& status) {
166-
load_status = status;
167-
load_done.Notify();
168-
});
164+
absl::Status load_status;
165+
basic_manager_->LoadServable(servable_id,
166+
[&](const absl::Status& status) {
167+
load_status = status;
168+
load_done.Notify();
169+
});
169170
load_done.WaitForNotification();
170171
TF_RETURN_IF_ERROR(load_status);
171172
}
172173
}
173174
servable_id_mu.reset();
174175
MaybeEraseLoadMutexMapEntry(servable_id);
175-
return OkStatus();
176+
return absl::OkStatus();
176177
}
177178

178179
void CachingManager::MaybeEraseLoadMutexMapEntry(

tensorflow_serving/core/log_collector_test.cc

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,10 @@ namespace {
2828

2929
class FakeLogCollector : public LogCollector {
3030
public:
31-
Status CollectMessage(const google::protobuf::Message& message) { return OkStatus(); }
32-
Status Flush() override { return OkStatus(); }
31+
absl::Status CollectMessage(const google::protobuf::Message& message) {
32+
return absl::OkStatus();
33+
}
34+
absl::Status Flush() override { return absl::OkStatus(); }
3335
};
3436

3537
LogCollectorConfig CreateConfig(const string& type,
@@ -52,7 +54,7 @@ TEST(LogCollectorTest, Registration) {
5254
"registered", [](const LogCollectorConfig& config, const uint32 id,
5355
std::unique_ptr<LogCollector>* log_collector) {
5456
*log_collector = std::unique_ptr<LogCollector>(new FakeLogCollector());
55-
return OkStatus();
57+
return absl::OkStatus();
5658
}));
5759
std::unique_ptr<LogCollector> log_collector;
5860
TF_ASSERT_OK(LogCollector::Create(
@@ -62,7 +64,7 @@ TEST(LogCollectorTest, Registration) {
6264
auto duplicate_factory = [](const LogCollectorConfig& config, const uint32 id,
6365
std::unique_ptr<LogCollector>* log_collector) {
6466
*log_collector = std::unique_ptr<LogCollector>(new FakeLogCollector());
65-
return OkStatus();
67+
return absl::OkStatus();
6668
};
6769
REGISTER_LOG_COLLECTOR("duplicate", duplicate_factory);
6870

@@ -71,15 +73,15 @@ TEST(LogCollectorTest, DuplicateRegistration) {
7173
"duplicate", [](const LogCollectorConfig& config, const uint32 id,
7274
std::unique_ptr<LogCollector>* log_collector) {
7375
*log_collector = std::unique_ptr<LogCollector>(new FakeLogCollector());
74-
return OkStatus();
76+
return absl::OkStatus();
7577
});
7678
EXPECT_EQ(status.code(), error::ALREADY_EXISTS);
7779
}
7880

7981
auto creation_factory = [](const LogCollectorConfig& config, const uint32 id,
8082
std::unique_ptr<LogCollector>* log_collector) {
8183
*log_collector = std::unique_ptr<LogCollector>(new FakeLogCollector());
82-
return OkStatus();
84+
return absl::OkStatus();
8385
};
8486
REGISTER_LOG_COLLECTOR("creation", creation_factory);
8587

tensorflow_serving/core/manager_test.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ class TestManager : public Manager {
5151
}
5252

5353
private:
54-
Status GetUntypedServableHandle(
54+
absl::Status GetUntypedServableHandle(
5555
const ServableRequest& request,
5656
std::unique_ptr<UntypedServableHandle>* result) override {
5757
result->reset(new TestHandle);
58-
return OkStatus();
58+
return absl::OkStatus();
5959
}
6060

6161
std::map<ServableId, std::unique_ptr<UntypedServableHandle>>
@@ -104,11 +104,11 @@ TEST(ManagerTest, GetAvailableServableHandlesWrongType) {
104104
// is handled gracefully rather than a crash or memory corruption.
105105
class ReturnNullManager : public TestManager {
106106
private:
107-
Status GetUntypedServableHandle(
107+
absl::Status GetUntypedServableHandle(
108108
const ServableRequest& request,
109109
std::unique_ptr<UntypedServableHandle>* result) override {
110110
*result = nullptr;
111-
return OkStatus();
111+
return absl::OkStatus();
112112
}
113113
};
114114

@@ -122,7 +122,7 @@ TEST(ManagerTest, NullHandleReturnsError) {
122122
// A manager that returns an error even though the result is non-null.
123123
class ReturnErrorManager : public TestManager {
124124
private:
125-
Status GetUntypedServableHandle(
125+
absl::Status GetUntypedServableHandle(
126126
const ServableRequest& request,
127127
std::unique_ptr<UntypedServableHandle>* result) override {
128128
result->reset(new TestHandle);

tensorflow_serving/core/manager_wrapper.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ std::vector<ServableId> ManagerWrapper::ListAvailableServableIds() const {
3030
return wrapped_->ListAvailableServableIds();
3131
}
3232

33-
Status ManagerWrapper::GetUntypedServableHandle(
33+
absl::Status ManagerWrapper::GetUntypedServableHandle(
3434
const ServableRequest& request,
3535
std::unique_ptr<UntypedServableHandle>* const untyped_handle) {
3636
return wrapped_->GetUntypedServableHandle(request, untyped_handle);

tensorflow_serving/core/prefix_storage_path_source_adapter.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ PrefixStoragePathSourceAdapter::PrefixStoragePathSourceAdapter(
2828

2929
PrefixStoragePathSourceAdapter::~PrefixStoragePathSourceAdapter() { Detach(); }
3030

31-
Status PrefixStoragePathSourceAdapter::Convert(const StoragePath& source,
32-
StoragePath* destination) {
31+
absl::Status PrefixStoragePathSourceAdapter::Convert(const StoragePath& source,
32+
StoragePath* destination) {
3333
*destination = tensorflow::io::JoinPath(prefix_, source);
34-
return OkStatus();
34+
return absl::OkStatus();
3535
}
3636

3737
} // namespace serving

tensorflow_serving/core/request_logger.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ RequestLogger::RequestLogger(const LoggingConfig& logging_config,
4646
log_collector_(std::move(log_collector)),
4747
uniform_sampler_() {}
4848

49-
Status RequestLogger::Log(const google::protobuf::Message& request,
50-
const google::protobuf::Message& response,
51-
const LogMetadata& log_metadata) {
49+
absl::Status RequestLogger::Log(const google::protobuf::Message& request,
50+
const google::protobuf::Message& response,
51+
const LogMetadata& log_metadata) {
5252
const double sampling_rate =
5353
logging_config_.sampling_config().sampling_rate();
5454
LogMetadata log_metadata_with_config = log_metadata;
@@ -71,10 +71,10 @@ Status RequestLogger::Log(const google::protobuf::Message& request,
7171
->IncrementBy(1);
7272
return status;
7373
}
74-
return OkStatus();
74+
return absl::OkStatus();
7575
}
7676

77-
Status RequestLogger::Log(const google::protobuf::Message& log) {
77+
absl::Status RequestLogger::Log(const google::protobuf::Message& log) {
7878
return log_collector_->CollectMessage(log);
7979
}
8080

tensorflow_serving/core/request_logger_test.cc

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,10 @@ TEST_F(RequestLoggerTest, Simple) {
9898
test_util::EqualsProto(expected_log_metadata));
9999
*log =
100100
std::unique_ptr<google::protobuf::Any>(new google::protobuf::Any());
101-
return OkStatus();
101+
return absl::OkStatus();
102102
}));
103-
EXPECT_CALL(*log_collector_, CollectMessage(_)).WillOnce(Return(OkStatus()));
103+
EXPECT_CALL(*log_collector_, CollectMessage(_))
104+
.WillOnce(Return(absl::OkStatus()));
104105
TF_ASSERT_OK(request_logger_->Log(request, PredictResponse(), log_metadata));
105106
}
106107

@@ -122,7 +123,7 @@ TEST_F(RequestLoggerTest, ErroringCollectMessage) {
122123
std::unique_ptr<google::protobuf::Message>* log) {
123124
*log =
124125
std::unique_ptr<google::protobuf::Any>(new google::protobuf::Any());
125-
return OkStatus();
126+
return absl::OkStatus();
126127
}));
127128
EXPECT_CALL(*log_collector_, CollectMessage(_))
128129
.WillRepeatedly(Return(errors::Internal("Error")));
@@ -150,8 +151,9 @@ TEST_F(RequestLoggerTest, LoggingStreamSucceeds) {
150151
.WillOnce(DoAll(WithArg<1>([](std::unique_ptr<google::protobuf::Message>* log) {
151152
*log = std::make_unique<google::protobuf::Any>();
152153
}),
153-
Return(OkStatus())));
154-
EXPECT_CALL(*log_collector_, CollectMessage(_)).WillOnce(Return(OkStatus()));
154+
Return(absl::OkStatus())));
155+
EXPECT_CALL(*log_collector_, CollectMessage(_))
156+
.WillOnce(Return(absl::OkStatus()));
155157
TF_ASSERT_OK(logger->LogMessage());
156158
}
157159

@@ -173,7 +175,7 @@ TEST_F(RequestLoggerTest, LoggingStreamRequestLoggerDiesBeforeStreamCloses) {
173175
.WillOnce(DoAll(WithArg<1>([](std::unique_ptr<google::protobuf::Message>* log) {
174176
*log = std::make_unique<google::protobuf::Any>();
175177
}),
176-
Return(OkStatus())));
178+
Return(absl::OkStatus())));
177179
EXPECT_CALL(*log_collector_, CollectMessage(_)).Times(0);
178180

179181
request_logger_.reset();

0 commit comments

Comments
 (0)