Skip to content

Commit 6b9a9d9

Browse files
committed
Update "master" to "dispatch"/"dispatcher" in tf.data service terminology.
Dispatcher is more descriptive and follows the guidance in https://developers.google.com/style/word-list#master PiperOrigin-RevId: 321613785 Change-Id: Iaa576d35f0581e21278101f8b31201ba737a6865
1 parent 0aa1d61 commit 6b9a9d9

30 files changed

+367
-353
lines changed

tensorflow/core/data/service/BUILD

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ tf_proto_library(
2828
)
2929

3030
tf_proto_library(
31-
name = "master_proto",
32-
srcs = ["master.proto"],
31+
name = "dispatcher_proto",
32+
srcs = ["dispatcher.proto"],
3333
has_services = 1,
3434
cc_api_version = 2,
3535
protodeps = tf_additional_all_protos() + [
@@ -49,17 +49,17 @@ tf_proto_library(
4949
)
5050

5151
cc_library(
52-
name = "master_impl",
53-
srcs = ["master_impl.cc"],
52+
name = "dispatcher_impl",
53+
srcs = ["dispatcher_impl.cc"],
5454
hdrs = [
55-
"master_impl.h",
55+
"dispatcher_impl.h",
5656
],
5757
deps = [
5858
":common_proto_cc",
5959
":credentials_factory",
6060
":data_service",
61+
":dispatcher_proto_cc",
6162
":grpc_util",
62-
":master_proto_cc",
6363
":worker_cc_grpc_proto",
6464
":worker_proto_cc",
6565
"//tensorflow/c:c_api_internal",
@@ -86,9 +86,9 @@ cc_library(
8686
deps = [
8787
":common_proto_cc",
8888
":credentials_factory",
89+
":dispatcher_cc_grpc_proto",
90+
":dispatcher_proto_cc",
8991
":grpc_util",
90-
":master_cc_grpc_proto",
91-
":master_proto_cc",
9292
":worker_proto_cc",
9393
"//tensorflow/c:c_api_internal",
9494
"//tensorflow/c:tf_status_helper",
@@ -207,12 +207,12 @@ tf_cc_test(
207207
)
208208

209209
cc_library(
210-
name = "grpc_master_impl",
211-
srcs = ["grpc_master_impl.cc"],
212-
hdrs = ["grpc_master_impl.h"],
210+
name = "grpc_dispatcher_impl",
211+
srcs = ["grpc_dispatcher_impl.cc"],
212+
hdrs = ["grpc_dispatcher_impl.h"],
213213
deps = [
214-
":master_cc_grpc_proto",
215-
":master_impl",
214+
":dispatcher_cc_grpc_proto",
215+
":dispatcher_impl",
216216
"//tensorflow/core/distributed_runtime/rpc:grpc_util",
217217
tf_grpc_cc_dependency(),
218218
],
@@ -250,7 +250,7 @@ cc_library(
250250
],
251251
deps = [
252252
":credentials_factory",
253-
":grpc_master_impl",
253+
":grpc_dispatcher_impl",
254254
":grpc_util",
255255
":grpc_worker_impl",
256256
"//tensorflow/core:lib",
@@ -268,9 +268,9 @@ cc_library(
268268
],
269269
deps = [
270270
":credentials_factory",
271+
":dispatcher_cc_grpc_proto",
272+
":dispatcher_proto_cc",
271273
":grpc_util",
272-
":master_cc_grpc_proto",
273-
":master_proto_cc",
274274
":worker_cc_grpc_proto",
275275
":worker_proto_cc",
276276
"//tensorflow/core:framework",
@@ -287,12 +287,12 @@ tf_cc_test(
287287
tags = ["no_windows"],
288288
deps = [
289289
":data_service",
290-
":grpc_master_impl",
290+
":dispatcher_cc_grpc_proto",
291+
":dispatcher_proto_cc",
292+
":grpc_dispatcher_impl",
291293
":grpc_util",
292294
":grpc_worker_impl",
293295
":local_credentials_factory",
294-
":master_cc_grpc_proto",
295-
":master_proto_cc",
296296
":server_lib",
297297
":test_cluster",
298298
":test_util",
@@ -309,11 +309,11 @@ tf_cc_test(
309309
)
310310

311311
cc_grpc_library(
312-
name = "master_cc_grpc_proto",
313-
srcs = [":master_proto"],
312+
name = "dispatcher_cc_grpc_proto",
313+
srcs = [":dispatcher_proto"],
314314
generate_mocks = True,
315315
grpc_only = True,
316-
deps = [":master_proto_cc"],
316+
deps = [":dispatcher_proto_cc"],
317317
)
318318

319319
cc_grpc_library(

tensorflow/core/data/service/data_service.cc

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ limitations under the License.
1818
#include "grpcpp/create_channel.h"
1919
#include "grpcpp/security/credentials.h"
2020
#include "tensorflow/core/data/service/credentials_factory.h"
21+
#include "tensorflow/core/data/service/dispatcher.grpc.pb.h"
2122
#include "tensorflow/core/data/service/grpc_util.h"
22-
#include "tensorflow/core/data/service/master.grpc.pb.h"
2323
#include "tensorflow/core/data/service/worker.grpc.pb.h"
2424
#include "tensorflow/core/framework/dataset.h"
2525

@@ -54,8 +54,8 @@ std::string ProcessingModeToString(ProcessingMode mode) {
5454
}
5555
}
5656

57-
Status DataServiceMasterClient::RegisterDataset(GraphDef dataset,
58-
int64* dataset_id) {
57+
Status DataServiceDispatcherClient::RegisterDataset(GraphDef dataset,
58+
int64* dataset_id) {
5959
TF_RETURN_IF_ERROR(EnsureInitialized());
6060
GetOrRegisterDatasetRequest req;
6161
*req.mutable_dataset()->mutable_graph() = dataset;
@@ -69,9 +69,9 @@ Status DataServiceMasterClient::RegisterDataset(GraphDef dataset,
6969
return Status::OK();
7070
}
7171

72-
Status DataServiceMasterClient::CreateJob(int64 dataset_id,
73-
ProcessingMode processing_mode,
74-
int64* job_id) {
72+
Status DataServiceDispatcherClient::CreateJob(int64 dataset_id,
73+
ProcessingMode processing_mode,
74+
int64* job_id) {
7575
TF_RETURN_IF_ERROR(EnsureInitialized());
7676
CreateJobRequest req;
7777
req.set_dataset_id(dataset_id);
@@ -88,11 +88,9 @@ Status DataServiceMasterClient::CreateJob(int64 dataset_id,
8888
return Status::OK();
8989
}
9090

91-
Status DataServiceMasterClient::GetOrCreateJob(int64 dataset_id,
92-
ProcessingMode processing_mode,
93-
const std::string& job_name,
94-
int job_name_index,
95-
int64* job_id) {
91+
Status DataServiceDispatcherClient::GetOrCreateJob(
92+
int64 dataset_id, ProcessingMode processing_mode,
93+
const std::string& job_name, int job_name_index, int64* job_id) {
9694
TF_RETURN_IF_ERROR(EnsureInitialized());
9795
GetOrCreateJobRequest req;
9896
req.set_dataset_id(dataset_id);
@@ -112,9 +110,9 @@ Status DataServiceMasterClient::GetOrCreateJob(int64 dataset_id,
112110
return Status::OK();
113111
}
114112

115-
Status DataServiceMasterClient::GetTasks(int64 job_id,
116-
std::vector<TaskInfo>* tasks,
117-
bool* job_finished) {
113+
Status DataServiceDispatcherClient::GetTasks(int64 job_id,
114+
std::vector<TaskInfo>* tasks,
115+
bool* job_finished) {
118116
TF_RETURN_IF_ERROR(EnsureInitialized());
119117
GetTasksRequest req;
120118
req.set_job_id(job_id);
@@ -132,7 +130,8 @@ Status DataServiceMasterClient::GetTasks(int64 job_id,
132130
return Status::OK();
133131
}
134132

135-
Status DataServiceMasterClient::GetWorkers(std::vector<WorkerInfo>* workers) {
133+
Status DataServiceDispatcherClient::GetWorkers(
134+
std::vector<WorkerInfo>* workers) {
136135
TF_RETURN_IF_ERROR(EnsureInitialized());
137136
GetWorkersRequest req;
138137
GetWorkersResponse resp;
@@ -148,12 +147,12 @@ Status DataServiceMasterClient::GetWorkers(std::vector<WorkerInfo>* workers) {
148147
return Status::OK();
149148
}
150149

151-
Status DataServiceMasterClient::EnsureInitialized() {
150+
Status DataServiceDispatcherClient::EnsureInitialized() {
152151
std::shared_ptr<grpc::ChannelCredentials> credentials;
153152
TF_RETURN_IF_ERROR(
154153
CredentialsFactory::CreateClientCredentials(protocol_, &credentials));
155154
auto channel = grpc::CreateChannel(address_, credentials);
156-
stub_ = MasterService::NewStub(channel);
155+
stub_ = DispatcherService::NewStub(channel);
157156
return Status::OK();
158157
}
159158

@@ -187,10 +186,11 @@ Status DataServiceWorkerClient::EnsureInitialized() {
187186
return Status::OK();
188187
}
189188

190-
Status CreateDataServiceMasterClient(
189+
Status CreateDataServiceDispatcherClient(
191190
const std::string& address, const std::string& protocol,
192-
std::unique_ptr<DataServiceMasterClient>* out) {
193-
auto client = absl::make_unique<DataServiceMasterClient>(address, protocol);
191+
std::unique_ptr<DataServiceDispatcherClient>* out) {
192+
auto client =
193+
absl::make_unique<DataServiceDispatcherClient>(address, protocol);
194194
TF_RETURN_IF_ERROR(client->Initialize());
195195
*out = std::move(client);
196196
return Status::OK();

tensorflow/core/data/service/data_service.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ limitations under the License.
1616
#ifndef TENSORFLOW_CORE_DATA_SERVICE_DATA_SERVICE_H_
1717
#define TENSORFLOW_CORE_DATA_SERVICE_DATA_SERVICE_H_
1818

19-
#include "tensorflow/core/data/service/master.grpc.pb.h"
19+
#include "tensorflow/core/data/service/dispatcher.grpc.pb.h"
2020
#include "tensorflow/core/data/service/worker.grpc.pb.h"
2121
#include "tensorflow/core/framework/dataset.h"
2222
#include "tensorflow/core/framework/op_kernel.h"
@@ -67,11 +67,11 @@ class DataServiceClientBase {
6767
const std::string protocol_;
6868
};
6969

70-
// Client for communicating with the tf.data service master.
71-
class DataServiceMasterClient : public DataServiceClientBase {
70+
// Client for communicating with the tf.data service dispatcher.
71+
class DataServiceDispatcherClient : public DataServiceClientBase {
7272
public:
73-
DataServiceMasterClient(const std::string& address,
74-
const std::string& protocol)
73+
DataServiceDispatcherClient(const std::string& address,
74+
const std::string& protocol)
7575
: DataServiceClientBase(address, protocol) {}
7676

7777
// Registers a dataset with the tf.data service, and stores the generated
@@ -90,21 +90,21 @@ class DataServiceMasterClient : public DataServiceClientBase {
9090
const std::string& job_name, int job_name_index,
9191
int64* job_id);
9292

93-
// Queries the master for the tasks associated with the specified job.
93+
// Queries the dispatcher for the tasks associated with the specified job.
9494
// The tasks will be stored in *tasks, and whether the job is finished will
9595
// be stored in `*job_finished`.
9696
Status GetTasks(int64 job_id, std::vector<TaskInfo>* tasks,
9797
bool* job_finished);
9898

99-
// Queries the master for its registered workers. The worker info will be
99+
// Queries the dispatcher for its registered workers. The worker info will be
100100
// stored in `*workers`.
101101
Status GetWorkers(std::vector<WorkerInfo>* workers);
102102

103103
protected:
104104
Status EnsureInitialized() override;
105105

106106
private:
107-
std::unique_ptr<MasterService::Stub> stub_;
107+
std::unique_ptr<DispatcherService::Stub> stub_;
108108
};
109109

110110
// Client for communicating with the tf.data service worker.
@@ -127,10 +127,10 @@ class DataServiceWorkerClient : public DataServiceClientBase {
127127
std::unique_ptr<WorkerService::Stub> stub_;
128128
};
129129

130-
// Creates and initializes a new tf.data service master client.
131-
Status CreateDataServiceMasterClient(
130+
// Creates and initializes a new tf.data service dispatcher client.
131+
Status CreateDataServiceDispatcherClient(
132132
const std::string& address, const std::string& protocol,
133-
std::unique_ptr<DataServiceMasterClient>* out);
133+
std::unique_ptr<DataServiceDispatcherClient>* out);
134134

135135
// Creates and initializes a new tf.data service worker client.
136136
Status CreateDataServiceWorkerClient(

tensorflow/core/data/service/data_service_test.cc

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ limitations under the License.
1919
#include "grpcpp/security/credentials.h"
2020
#include "absl/strings/str_split.h"
2121
#include "tensorflow/core/data/compression_utils.h"
22+
#include "tensorflow/core/data/service/dispatcher.grpc.pb.h"
23+
#include "tensorflow/core/data/service/dispatcher.pb.h"
2224
#include "tensorflow/core/data/service/grpc_util.h"
23-
#include "tensorflow/core/data/service/master.grpc.pb.h"
24-
#include "tensorflow/core/data/service/master.pb.h"
2525
#include "tensorflow/core/data/service/server_lib.h"
2626
#include "tensorflow/core/data/service/test_cluster.h"
2727
#include "tensorflow/core/data/service/test_util.h"
@@ -66,9 +66,10 @@ TEST(DataService, ProcessingModeToString) {
6666
TEST(DataService, GetWorkers) {
6767
TestCluster cluster(1);
6868
TF_ASSERT_OK(cluster.Initialize());
69-
DataServiceMasterClient master(cluster.MasterAddress(), kProtocol);
69+
DataServiceDispatcherClient dispatcher(cluster.DispatcherAddress(),
70+
kProtocol);
7071
std::vector<WorkerInfo> workers;
71-
TF_EXPECT_OK(master.GetWorkers(&workers));
72+
TF_EXPECT_OK(dispatcher.GetWorkers(&workers));
7273
EXPECT_EQ(1, workers.size());
7374
}
7475

tensorflow/core/data/service/master.proto renamed to tensorflow/core/data/service/dispatcher.proto

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,11 @@ message GetWorkersResponse {
110110
repeated WorkerInfo workers = 1;
111111
}
112112

113-
service MasterService {
114-
// Registers a worker with the master.
113+
service DispatcherService {
114+
// Registers a worker with the dispatcher.
115115
rpc RegisterWorker(RegisterWorkerRequest) returns (RegisterWorkerResponse);
116116

117-
// Updates the master with information about the worker's state.
117+
// Updates the dispatcher with information about the worker's state.
118118
rpc WorkerUpdate(WorkerUpdateRequest) returns (WorkerUpdateResponse);
119119

120120
// Registers a dataset with the server, or returns its id if it is already
@@ -134,6 +134,6 @@ service MasterService {
134134
// Reports a list of all tasks for a job.
135135
rpc GetTasks(GetTasksRequest) returns (GetTasksResponse);
136136

137-
// Reports a list of all workers registered with the master.
137+
// Reports a list of all workers registered with the dispatcher.
138138
rpc GetWorkers(GetWorkersRequest) returns (GetWorkersResponse);
139139
}

0 commit comments

Comments
 (0)