xref: /aosp_15_r20/external/federated-compute/fcp/protos/ondevicepersonalization/task_assignments.proto (revision 14675a029014e728ec732f129a32e299b2da0601)
1/**
2 * Copyright 2023 Google LLC
3 *
4 * <p>Licensed under the Apache License, Version 2.0 (the "License"); you may
5 * not use this file except in compliance with the License. You may obtain a
6 * copy of the License at
7 *
8 * <p>http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * <p>Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 * License for the specific language governing permissions and limitations under
14 * the License.
15 */
16syntax = "proto3";
17
18package google.ondevicepersonalization.federatedcompute.proto;
19
20import "fcp/protos/federatedcompute/common.proto";
21import "fcp/protos/plan.proto";
22import "fcp/protos/ondevicepersonalization/eligibility_spec.proto";
23import "fcp/protos/ondevicepersonalization/common.proto";
24
25option java_package = "com.google.ondevicepersonalization.federatedcompute.proto";
26option java_multiple_files = true;
27
28// Create task assignment request.
29// The url to create task assignment under v1 API is:
30// https://{host}/taskassignment/v1/population/{populationName}:create-task-assignment
31// Next Id: 3
32message CreateTaskAssignmentRequest {
33  google.internal.federatedcompute.v1.ClientVersion client_version = 1;
34
35  // The client's capabilities when downloading and processing resources.
36  google.internal.federatedcompute.v1.ResourceCapabilities resource_capabilities = 2;
37}
38
39// Create task assignment response.
40// Next Id: 3
41message CreateTaskAssignmentResponse {
42  // One of two outcomes, depending on server's decision on participation of the
43  // client.
44  oneof result {
45    // If the client joined the task with this call, information on how to
46    // proceed.
47    TaskAssignment task_assignment = 1;
48
49    // If the client was not accepted, information how to proceed.
50    google.internal.federatedcompute.v1.RejectionInfo rejection_info = 2;
51  }
52}
53
54// When client (device) is accepted for the current task, this data structure
55// carries information necessary to begin task execution.
56// Next Id: 12
57message TaskAssignment {
58  // population name.
59  string population_name = 1;
60
61  // the task id
62  string task_id = 2;
63
64  // The opaque id of the aggregation session the client has joined. This is a
65  // string generated by the server and MUST NOT contain any information that
66  // could be used to identify a specific device.
67  string aggregation_id = 3;
68
69  // assignment id
70  string assignment_id = 4;
71
72  // The identifier of the task that was assigned. It's better to use the combination of
73  // `population_name` and `task_id` to identify a task.
74  string task_name = 5;
75
76  // The checkpoint from which to start execution.
77  google.internal.federatedcompute.v1.Resource init_checkpoint = 6;
78
79  // The plan to be used for execution.
80  google.internal.federatedcompute.v1.Resource plan = 7;
81
82  // self uri
83  string self_uri = 8;
84
85  // The eligibility of the task. Device need to run this eligibility task
86  // to check if it's qualified to start the job before execute real task.
87  EligibilityTaskInfo eligibility_task_info = 9;
88
89  // The signature of eligibility task.
90  Signature eligibility_task_info_signature = 10;
91
92  // Specifies an example selection procedure. Can be used by model versioning.
93  google.internal.federated.plan.ExampleSelector example_selector = 11;
94}
95
96// The signature information. Device can verify the signature to check integrity of
97// the content.
98message Signature {}
99
100// Report result request.
101// The url to report result under v1 API is:
102// https://{host}/taskassignment/v1/population/{populationName}/task/{taskId}/aggregation/{aggregationId}/task-assignment/{assignmentId}:report-result
103// Next Id: 3
104message ReportResultRequest {
105  enum Result {
106    // Unknown
107    UNKNOWN = 0;
108
109    // Completed
110    COMPLETED = 1;
111
112    // Failed.
113    FAILED = 2;
114
115    // Failed due to eligibility task is not qualified.
116    NOT_ELIGIBLE = 3;
117
118    // Failed due to example generation failure
119    FAILED_EXAMPLE_GENERATION = 4;
120
121    // Failed due to model computation error
122    FAILED_MODEL_COMPUTATION = 5;
123
124    // Failed due to model ops error
125    FAILED_OPS_ERROR = 6;
126  }
127
128  Result result = 1;
129
130  // The client's capabilities when uploading result.
131  google.internal.federatedcompute.v1.ResourceCapabilities resource_capabilities = 2;
132}
133
134// Report result response.
135message ReportResultResponse {
136  // Upload result instruction on succeeded.
137  UploadInstruction upload_instruction = 1;
138
139  // Rejection reason.
140  google.internal.federatedcompute.v1.RejectionInfo rejection_info = 2;
141}
142