Skip to content

Commit 34bf62a

Browse files
Merge branch 'tensorflow:master' into bump-ubuntu-to-22.04
2 parents 7f41d0e + 0df40b3 commit 34bf62a

38 files changed

+616
-426
lines changed

.bazelrc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,8 @@ build --copt=-Wno-macro-redefined # absl vs tsl logging clash
106106
build --copt=-Wno-sign-compare # int as loop variable
107107
build --copt=-Wno-deprecated-declarations
108108
build --copt=-Wno-unused-but-set-variable # due to `ifdefs` in ml_dtypes
109+
110+
# Revert to the legacy WORKSPACE dependency resolution system
111+
# and disable Bzlmod.
112+
common --enable_bzlmod=false
113+
common --noincompatible_enable_cc_toolchain_resolution

WORKSPACE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ tf_serving_workspace()
3838

3939
# Check bazel version requirement, which is stricter than TensorFlow's.
4040
load("@bazel_skylib//lib:versions.bzl", "versions")
41-
versions.check("6.5.0")
41+
versions.check("7.4.1")
4242

4343
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
4444

tensorflow_serving/apis/internal/BUILD

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@
22

33
load("//tensorflow_serving:serving.bzl", "serving_proto_library")
44

5-
package(
6-
default_visibility = [
7-
"//tensorflow_serving:internal",
8-
],
9-
features = ["-layering_check"],
10-
)
5+
package(features = ["-layering_check"])
116

127
licenses(["notice"])
138

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/aspired_versions_manager_builder_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ TEST_F(AspiredVersionsManagerBuilderTest, AddSourceChainConnection) {
9191
servable_state_monitor_, id, {ServableState::ManagerState::kAvailable});
9292

9393
ServableHandle<StoragePath> handle;
94-
const Status status =
94+
const absl::Status status =
9595
manager->GetServableHandle(ServableRequest::FromId(id), &handle);
9696
EXPECT_EQ(StoragePath("/storage/path/adapter0/adapter1/adapter2"), *handle);
9797
}

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/caching_manager_test.cc

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class StringLoaderFactory : public CachingManager::LoaderFactory {
6565
auto servable_creator = [&](std::unique_ptr<string>* servable) {
6666
servable->reset(new string);
6767
**servable = strings::StrCat(id.name, "-", id.version);
68-
return OkStatus();
68+
return absl::OkStatus();
6969
};
7070
std::unique_ptr<Loader> loader;
7171
loader.reset(new SimpleLoader<string>(
@@ -346,7 +346,7 @@ TEST_P(CachingManagerTest, ServableHandleWrongType) {
346346
// The servable is supposed to be of type string, but we request for a handle
347347
// of type int. This should cause an invalid argument error.
348348
ServableHandle<int> handle;
349-
const Status status = manager_->GetServableHandle(
349+
const absl::Status status = manager_->GetServableHandle(
350350
ServableRequest::FromId({kServableName, 30}), &handle);
351351
ASSERT_FALSE(status.ok()) << status;
352352
EXPECT_EQ(error::INVALID_ARGUMENT, status.code());
@@ -357,7 +357,7 @@ TEST_P(CachingManagerTest, ServableHandleError) {
357357
std::unique_ptr<CachingManager> error_manager =
358358
CreateManagerWithErrorLoaderFactory();
359359
ServableHandle<string> handle;
360-
const Status status = error_manager->GetServableHandle(
360+
const absl::Status status = error_manager->GetServableHandle(
361361
ServableRequest::FromId({kServableName, 30}), &handle);
362362
EXPECT_FALSE(status.ok()) << status;
363363
}
@@ -419,7 +419,7 @@ TEST_P(CachingManagerTest, AvailableServableHandlesError) {
419419
std::unique_ptr<CachingManager> error_manager =
420420
CreateManagerWithErrorLoaderFactory();
421421
ServableHandle<string> handle;
422-
const Status status = error_manager->GetServableHandle(
422+
const absl::Status status = error_manager->GetServableHandle(
423423
ServableRequest::FromId({kServableName, 30}), &handle);
424424
ASSERT_FALSE(status.ok()) << status;
425425
std::map<ServableId, ServableHandle<string>> handles =
@@ -474,7 +474,7 @@ TEST_P(CachingManagerTest, EventBusSingleRequest) {
474474
// Check that the state published on the event-bus matches produced by the
475475
// loader-factory for a successful request.
476476
const ServableState expected_published_state = {
477-
id, ServableState::ManagerState::kAvailable, OkStatus()};
477+
id, ServableState::ManagerState::kAvailable, absl::OkStatus()};
478478
EXPECT_THAT(*servable_state_monitor_.GetState(id),
479479
EqualsServableState(expected_published_state));
480480
}
@@ -485,7 +485,7 @@ TEST_P(CachingManagerTest, EventBusErrorHandle) {
485485
CreateManagerWithErrorLoaderFactory();
486486
ServableHandle<string> handle;
487487
const ServableId id = {kServableName, 30};
488-
const Status status =
488+
const absl::Status status =
489489
error_manager->GetServableHandle(ServableRequest::FromId(id), &handle);
490490
// Check that the state published on the event-bus matches that produced
491491
// by the loader-factory for an error.
@@ -502,14 +502,14 @@ TEST_P(CachingManagerTest, EventBusErrorHandle) {
502502
TEST_P(CachingManagerTest, ConcurrentDisjointRequests) {
503503
// Track the status of each request.
504504
mutex status_mu;
505-
std::vector<Status> statuses(4);
505+
std::vector<absl::Status> statuses(4);
506506
{
507507
ThreadPoolExecutor request_executor(Env::Default(), "GetHandles",
508508
kNumThreads);
509509
for (int i = 0; i < 4; i++) {
510510
request_executor.Schedule([this, i, &statuses, &status_mu]() {
511511
ServableHandle<string> handle;
512-
const Status status =
512+
const absl::Status status =
513513
manager_->GetServableHandle({kServableName, i + 30}, &handle);
514514
mutex_lock l(status_mu);
515515
statuses[i] = status;
@@ -519,7 +519,7 @@ TEST_P(CachingManagerTest, ConcurrentDisjointRequests) {
519519
// Check that all requests returned with an ok status.
520520
for (int i = 0; i < 4; i++) {
521521
mutex_lock l(status_mu);
522-
EXPECT_EQ(OkStatus(), statuses[i]);
522+
EXPECT_EQ(absl::OkStatus(), statuses[i]);
523523
}
524524
// Check that the available servable handles now includes all requested
525525
// servables.
@@ -542,7 +542,7 @@ TEST_P(CachingManagerTest, ConcurrentDisjointRequests) {
542542

543543
TEST_P(CachingManagerTest, ConcurrentIntersectingRequests) {
544544
mutex status_mu;
545-
std::vector<Status> statuses(8);
545+
std::vector<absl::Status> statuses(8);
546546
{
547547
ThreadPoolExecutor request_executor(Env::Default(), "GetHandles",
548548
kNumThreads);
@@ -552,7 +552,7 @@ TEST_P(CachingManagerTest, ConcurrentIntersectingRequests) {
552552
const ServableId id = {kServableName, version};
553553
request_executor.Schedule([this, i, id, &statuses, &status_mu]() {
554554
ServableHandle<string> handle;
555-
const Status status =
555+
const absl::Status status =
556556
manager_->GetServableHandle(ServableRequest::FromId(id), &handle);
557557
mutex_lock l(status_mu);
558558
statuses[i] = status;
@@ -562,7 +562,7 @@ TEST_P(CachingManagerTest, ConcurrentIntersectingRequests) {
562562
// Check that all requests returned with an ok status.
563563
for (int i = 0; i < 8; i++) {
564564
mutex_lock l(status_mu);
565-
EXPECT_EQ(OkStatus(), statuses[i]);
565+
EXPECT_EQ(absl::OkStatus(), statuses[i]);
566566
}
567567
// Check that the available servable handles now includes all requested
568568
// servables.

tensorflow_serving/core/load_servables_fast.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,10 @@ std::function<void(const uint32)> SetManagerNumLoadThreadsNotifier(
4444
return manager->set_num_load_threads_observer_->Notifier();
4545
}
4646

47-
Status ConnectSourcesWithFastInitialLoad(
47+
absl::Status ConnectSourcesWithFastInitialLoad(
4848
AspiredVersionsManager* manager,
4949
std::vector<Source<std::unique_ptr<Loader>>*> sources,
50-
const std::function<Status()>& wait_until_loaded_fn,
50+
const std::function<absl::Status()>& wait_until_loaded_fn,
5151
const uint32 num_threads) {
5252
const uint32 prev_num_load_threads = GetManagerNumLoadThreads(manager);
5353
std::function<void(const uint32)> set_manager_num_load_threads =
@@ -56,14 +56,14 @@ Status ConnectSourcesWithFastInitialLoad(
5656
for (Source<std::unique_ptr<Loader>>* source : sources) {
5757
ConnectSourceToTarget(source, manager);
5858
}
59-
const Status status = wait_until_loaded_fn();
59+
const absl::Status status = wait_until_loaded_fn();
6060
set_manager_num_load_threads(prev_num_load_threads);
6161
return status;
6262
}
6363

6464
} // namespace internal
6565

66-
Status ConnectSourceWithFastInitialLoad(
66+
absl::Status ConnectSourceWithFastInitialLoad(
6767
AspiredVersionsManager* manager, Source<std::unique_ptr<Loader>>* source,
6868
ServableStateMonitor* servable_state_monitor,
6969
const std::vector<ServableRequest>& initial_servables,
@@ -73,7 +73,7 @@ Status ConnectSourceWithFastInitialLoad(
7373
initial_servables, num_threads);
7474
}
7575

76-
Status ConnectSourcesWithFastInitialLoad(
76+
absl::Status ConnectSourcesWithFastInitialLoad(
7777
AspiredVersionsManager* manager,
7878
std::vector<Source<std::unique_ptr<Loader>>*> sources,
7979
ServableStateMonitor* servable_state_monitor,
@@ -116,7 +116,7 @@ Status ConnectSourcesWithFastInitialLoad(
116116
strings::StrAppend(&message, "}");
117117
return errors::Unknown(message);
118118
}
119-
return OkStatus();
119+
return absl::OkStatus();
120120
},
121121
num_threads);
122122
}

0 commit comments

Comments
 (0)