xref: /aosp_15_r20/external/federated-compute/fcp/protos/federatedcompute/task_assignments.proto (revision 14675a029014e728ec732f129a32e299b2da0601)
1// Copyright 2021 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto3";
16
17package google.internal.federatedcompute.v1;
18
19import "google/protobuf/duration.proto";
20import "fcp/protos/federated_api.proto";
21import "fcp/protos/federatedcompute/common.proto";
22
23option java_package = "com.google.internal.federatedcompute.v1";
24option java_multiple_files = true;
25
26service TaskAssignments {
27  // A request sent by the device to check if it should participate in the
28  // current task.
29  //
30  // Clients should use the same `ForwardingInfo` (incl. the headers) as used in
31  // this request to construct the URI to poll the operation service to check
32  // for task assignment completion.
33  //
34  // When the task assignment is complete, the result of the operation will
35  // either contain an error or the resulting `StartTaskAssignmentResponse` in
36  // the response.
37  //
38  // If the client no longer needs a task assignment because it is interrupted
39  // or drops out or an error occurs during polling the long running operation,
40  // the client should make a best effort to call CancelOperation.
41  //
42  // If the returned operation is not complete, clients should poll for status
43  // at the rate specified in the StartTaskAssignmentMetadata.
44  rpc StartTaskAssignment(StartTaskAssignmentRequest)
45      returns (StartTaskAssignmentResponse) {}
46
47  // A request sent by the device to participate in multiple tasks
48  // simultaneously.
49  //
50  // Unlike StartTaskAssignment, which returns at most one task assignment of
51  // the server's choice, this RPC attempts to return assignments for *all*
52  // tasks requested by the client.
53  rpc PerformMultipleTaskAssignments(PerformMultipleTaskAssignmentsRequest)
54      returns (PerformMultipleTaskAssignmentsResponse) {}
55
56  // A request sent by the device to report the result of running the task
57  // provided by `StartTaskAssignmentResponse`.
58  //
59  // Clients should use the same `ForwardingInfo` as used in the
60  // `StartTaskAssignment` request to construct the URI for this request.
61  //
62  // A result with a status code other than Code.OK indicates client session
63  // termination. The client may not send any future requests with the given
64  // session_id.
65  rpc ReportTaskResult(ReportTaskResultRequest)
66      returns (ReportTaskResultResponse) {}
67}
68
69message StartTaskAssignmentRequest {
70  // The name of the population this client belongs to.
71  //
72  // Note that http clients set this value in the request URL instead of the
73  // request body.
74  string population_name = 1
75      ;
76
77  // The session id returned by the server.
78  //
79  // Note that http clients set this value in the request URL instead of the
80  // request body.
81  string session_id = 2
82      ;
83
84  reserved 3;
85
86  ClientVersion client_version = 4;
87
88  // The client computes this message using the task returned by a previous
89  // `RequestEligibilityEvalTask` call.
90  //
91  // If this field is set, it describes to the server which tasks the client is
92  // (in)eligible. The server must take this information into account when
93  // deciding task to serve in response to this request.
94  //
95  // If this field is unset, it may indicate that the client previously received
96  // an `EligibilityEvalTask` without an `EligibilityEvalPayload` message (i.e.
97  // the population did not have an eligibility-computing task configured at the
98  // time of the request). It may also indicate a client for which the
99  // eligibility-computing task feature has been disabled, or an old client that
100  // does not support this feature yet.
101  //
102  // If this field is unset but the population has an eligibility-computing task
103  // configured, then the server must reject this client, since the server has
104  // no way to determine which tasks the client is (in)eligible for.
105  //
106  // If this field is unset and the population does not have an
107  // eligibility-computing task configured, then the server may serve this
108  // client any task.
109  //
110  google.internal.federatedml.v2.TaskEligibilityInfo task_eligibility_info = 5;
111
112  // The client's capabilities when downloading and processing resources.
113  ResourceCapabilities resource_capabilities = 6;
114}
115
116message StartTaskAssignmentMetadata {
117  // The suggested duration between instances of polling the StartTaskAssignment
118  // LRO.
119  google.protobuf.Duration polling_interval = 1;
120}
121
122message StartTaskAssignmentResponse {
123  // One of two outcomes, depending on server's decision on participation of the
124  // client.
125  oneof result {
126    // If the client joined the task with this call, information on how to
127    // proceed.
128    TaskAssignment task_assignment = 1;
129
130    // If the client was not accepted, information how to proceed.
131    RejectionInfo rejection_info = 2;
132  }
133}
134
135message PerformMultipleTaskAssignmentsRequest {
136  // The name of the population this client belongs to.
137  //
138  // Note that http clients set this value in the request URL instead of the
139  // request body.
140  string population_name = 1
141      ;
142
143  // The session id returned by the server.
144  string session_id = 2
145      ;
146
147  // The client's version information.
148  ClientVersion client_version = 3;
149
150  // The client's capabilities when downloading and processing resources.
151  ResourceCapabilities resource_capabilities = 4;
152
153  // The list of tasks for which the client would like TaskAssignments. These
154  // names are produced by running the population's Eligibility Eval task (see
155  // /EligibilityEvalTasks.RequestEligibilityEvalTask).
156  repeated string task_names = 5
157      ;
158}
159
160message PerformMultipleTaskAssignmentsResponse {
161  // The TaskAssignments requested by the client. The server may omit requested
162  // TaskAssignments, e.g. for any tasks that no longer exist or are not
163  // currently accepting client contributions; these cases should be infrequent.
164  repeated TaskAssignment task_assignments = 1;
165}
166
167// When client (device) is accepted for the current task, this data structure
168// carries information necessary to begin task execution.
169message TaskAssignment {
170  // Information to construct the URI to use for providing resulting aggregation
171  // data after task execution.
172  ForwardingInfo aggregation_data_forwarding_info = 1;
173
174  message AggregationInfo {}
175
176  message SecureAggregationInfo {
177    // The minimum number of clients' values that must be aggregated together
178    // before the server can gain access to the aggregate,
179    // even transiently (e.g. in RAM).
180    // This isn't needed by Secure Aggregation protocol on the client side but
181    // shared by the server with clients for transparency or policy reasons.
182    int32 minimum_clients_in_server_visible_aggregate = 1;
183  }
184
185  oneof aggregation_type {
186    // If set, indicates that the Aggregations service (see
187    // `aggregations.proto`) should be used to perform aggregation.
188    AggregationInfo aggregation_info = 9;
189
190    // If set, indicates that the SecureAggregations service (see
191    // `secure_aggregations.proto`) should be used to perform aggregation.
192    SecureAggregationInfo secure_aggregation_info = 10;
193  }
194
195  // Unique identifier for the client's protocol session.
196  string session_id = 5;
197
198  // The opaque id of the aggregation session the client has joined. This is a
199  // string generated by the server and MUST NOT contain any information that
200  // could be used to identify a specific device.
201  string aggregation_id = 2;
202
203  // Unique identifier for the client's participation in an aggregation session.
204  string authorization_token = 6;
205
206  // The name identifying the task that was assigned.
207  string task_name = 7;
208
209  // The checkpoint from which to start execution.
210  Resource init_checkpoint = 3;
211
212  // The plan to be used for execution.
213  Resource plan = 4;
214
215  // Info for how to generate URIs for fetching slices at runtime.
216  FederatedSelectUriInfo federated_select_uri_info = 8;
217}
218
219// Info for how to generate URIs for fetching slices that the task might request
220// to be downloaded at runtime.
221//
222// When one or more slices are requested by the task, the template specified
223// here should be used to form a URI from which the client can download the
224// slice data, by replacing the "{served_at_id}" and "{key_base10}" substrings
225// with the `google.internal.federated.plan.SlicesSelector.served_at_id` and the
226// base-10 representation of the `SlicesSelector.keys` value. The client must
227// not perform any URI escaping to the values that the substrings are replaced
228// with.
229message FederatedSelectUriInfo {
230  // The URI template to use for fetching slices.
231  //
232  // This template must always start with "https://".
233  //
234  // This template must contain the following substrings: "{served_at_id}" and
235  // "{key_base10}", as per the above documentation.
236  string uri_template = 1;
237}
238
239message ReportTaskResultRequest {
240  // The name of the population this client belongs to.
241  //
242  // Note that http clients set this value in the request URL instead of the
243  // request body.
244  string population_name = 1
245      ;
246
247  // The session id returned by the server.
248  //
249  // Note that http clients set this value in the request URL instead of the
250  // request body.
251  string session_id = 2
252      ;
253
254  // The opaque id of the aggregation session the client has joined. This is a
255  // string generated by the server and MUST NOT contain any information that
256  // could be used to identify a specific device.
257  string aggregation_id = 5
258      ;
259
260  // The name identifying the task that was assigned.
261  string task_name = 6;
262
263  // Computation status code reported by client.
264  // Code.OK indicates that the client computation completed successfully. Any
265  // other code indicates unsuccessful computation execution and termination of
266  // the protocol session.
267  int32 computation_status_code = 3;
268
269  // Stats produced during the client-side execution of the task.
270  ClientStats client_stats = 4;
271}
272
273// This message is used to report client stats and execution duration to the
274// server.
275message ClientStats {
276  // The time spent on running the task (includes I/O such as reading examples,
277  // but does not include time spent on the network for retrieving the task
278  // or uploading results).
279  google.protobuf.Duration computation_execution_duration = 1;
280}
281
282message ReportTaskResultResponse {}
283