• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1syntax = "proto3";
2
3package tensorflow.data;
4
5import "tensorflow/core/data/service/common.proto";
6import "tensorflow/core/framework/tensor.proto";
7import "tensorflow/core/protobuf/data_service.proto";
8
9// Next tag: 3
10message TaskProgress {
11  // The task that this message is about.
12  int64 task_id = 1;
13  // Whether the task has completed.
14  bool completed = 2;
15}
16
17// Next tag: 4
18message WorkerHeartbeatRequest {
19  string worker_address = 1;
20  string transfer_address = 3;
21  repeated int64 current_tasks = 2;
22}
23
24// Next tag: 3
25message WorkerHeartbeatResponse {
26  repeated TaskDef new_tasks = 1;
27  repeated int64 tasks_to_delete = 2;
28}
29
30// Next tag: 3
31message WorkerUpdateRequest {
32  string worker_address = 1;
33  repeated TaskProgress updates = 2;
34}
35
36// Next tag: 1
37message WorkerUpdateResponse {}
38
39// Next tag: 2
40message GetDatasetDefRequest {
41  int64 dataset_id = 1;
42}
43
44// Next tag: 2
45message GetDatasetDefResponse {
46  DatasetDef dataset_def = 1;
47}
48
49// Next tag: 4
50message GetSplitRequest {
51  int64 job_id = 1;
52  int64 repetition = 2;
53  int64 split_provider_index = 3;
54}
55
56// Next tag: 3
57message GetSplitResponse {
58  TensorProto split = 1;
59  bool end_of_splits = 2;
60}
61
62// Next tag: 1
63message GetVersionRequest {}
64
65// Next tag: 2
66message GetVersionResponse {
67  int64 version = 1;
68}
69
70// Next tag: 3
71message GetOrRegisterDatasetRequest {
72  // The dataset to register.
73  DatasetDef dataset = 1;
74  // The element spec of the dataset (encoded as a string).
75  bytes element_spec = 2;
76}
77
78// Next tag: 2
79message GetOrRegisterDatasetResponse {
80  // The id for the registered dataset.
81  int64 dataset_id = 1;
82}
83
84// Next tag: 2
85message GetElementSpecRequest {
86  // The id of the dataset to get the element spec for.
87  int64 dataset_id = 1;
88}
89
90// Next tag: 2
91message GetElementSpecResponse {
92  // The retrieved element spec.
93  bytes element_spec = 1;
94}
95
96// Next tag: 3
97message JobKey {
98  // A name for the job.
99  string job_name = 1;
100  // An index for the job. Multiple jobs can be created for the same name, if
101  // they have different indices.
102  int64 job_name_index = 2;
103}
104
105// Next tag: 10
106message GetOrCreateJobRequest {
107  reserved 2, 3, 4;
108  // The id of the dataset to create a job for.
109  int64 dataset_id = 1;
110  // A mode controlling how the tf.data service produces data for the job.
111  ProcessingModeDef processing_mode_def = 8;
112  // Optional job key identifying a shared job. If not set, the RPC will always
113  // create a new job.
114  JobKey job_key = 5;
115  // Optional number of consumers. If set, the job's tasks will provide their
116  // elements to consumers round-robin.
117  oneof optional_num_consumers {
118    int64 num_consumers = 7;
119  }
120  // Specifies which workers the client of this job reads from.
121  TargetWorkers target_workers = 9;
122}
123
124// Next tag: 2
125message GetOrCreateJobResponse {
126  // An id for the client that will read from the job. When the client is done
127  // with the job, they should call ReleaseJobClient with this id.
128  int64 job_client_id = 1;
129}
130
131// Next tag: 4
132message MaybeRemoveTaskRequest {
133  int64 task_id = 1;
134  int64 consumer_index = 2;
135  int64 round = 3;
136}
137
138// Next tag: 2
139message MaybeRemoveTaskResponse {
140  bool removed = 1;
141}
142
143// Next tag: 2
144message ReleaseJobClientRequest {
145  int64 job_client_id = 1;
146}
147
148// Next tag: 1
149message ReleaseJobClientResponse {}
150
151// Next tag: 5
152message ClientHeartbeatRequest {
153  reserved 3;
154  // The job client id to heartbeat for.
155  int64 job_client_id = 1;
156  // Reports which round the client is currently reading from when doing
157  // round-robin reads.
158  oneof optional_current_round {
159    int64 current_round = 2;
160  }
161  // Reports whether the client has successfully blocked the indicated round
162  // from starting. This enables the dispatcher to add a new task in the
163  // blocked round or later.
164  oneof optional_blocked_round {
165    int64 blocked_round = 4;
166  }
167}
168
169// Next tag: 4
170message ClientHeartbeatResponse {
171  // A list of all tasks that the client should read from.
172  repeated TaskInfo task_info = 1;
173  // Tells the client not to start the given round if possible.
174  oneof optional_block_round {
175    int64 block_round = 3;
176  }
177  // Whether the job has finished.
178  bool job_finished = 2;
179}
180
181// Next tag: 3
182message WorkerInfo {
183  string address = 1;
184  int64 id = 2;
185}
186
187// Next tag: 1
188message GetWorkersRequest {}
189
190// Next tag: 2
191message GetWorkersResponse {
192  // A list of all workers.
193  repeated WorkerInfo workers = 1;
194}
195
196service DispatcherService {
197  // Performs a periodic worker heartbeat.
198  rpc WorkerHeartbeat(WorkerHeartbeatRequest) returns (WorkerHeartbeatResponse);
199
200  // Updates the dispatcher with information about the worker's state.
201  rpc WorkerUpdate(WorkerUpdateRequest) returns (WorkerUpdateResponse);
202
203  // Gets a dataset defintion.
204  rpc GetDatasetDef(GetDatasetDefRequest) returns (GetDatasetDefResponse);
205
206  // Gets the next split for a given job.
207  rpc GetSplit(GetSplitRequest) returns (GetSplitResponse);
208
209  // Returns the API version of the server.
210  rpc GetVersion(GetVersionRequest) returns (GetVersionResponse);
211
212  // Registers a dataset with the server, or returns its id if it is already
213  // registered.
214  //
215  // The dataset is constructed in a new graph, so it must not refer to
216  // external resources or variables.
217  rpc GetOrRegisterDataset(GetOrRegisterDatasetRequest)
218      returns (GetOrRegisterDatasetResponse);
219
220  // Gets a job if it already exists, otherwise creates it.
221  rpc GetOrCreateJob(GetOrCreateJobRequest) returns (GetOrCreateJobResponse);
222
223  // Attempts to remove a task from a round-robin read job.
224  rpc MaybeRemoveTask(MaybeRemoveTaskRequest) returns (MaybeRemoveTaskResponse);
225
226  // Releases a job client so that a job may eventually be cleaned up.
227  rpc ReleaseJobClient(ReleaseJobClientRequest)
228      returns (ReleaseJobClientResponse);
229
230  // Heartbeats from the client. This lets the dispatcher know that the client
231  // is still active, and gives the dispatcher a chance to notify the client
232  // of new tasks.
233  rpc ClientHeartbeat(ClientHeartbeatRequest) returns (ClientHeartbeatResponse);
234
235  // Reports a list of all workers registered with the dispatcher.
236  rpc GetWorkers(GetWorkersRequest) returns (GetWorkersResponse);
237
238  // Returns the element spec for the registered dataset.
239  rpc GetElementSpec(GetElementSpecRequest) returns (GetElementSpecResponse);
240}
241