aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorqiaoli <qiaoli@google.com>2023-08-24 19:21:45 +0000
committerqiaoli <qiaoli@google.com>2023-08-29 21:30:30 +0000
commit03688b21ee4a9735035ec61083ec68d6dd216f8b (patch)
tree9148e4bc86d8086480745c5b9601c953a6a45e77
parent542ed3e5d57ae87cebbaaadfddb53661592fa0a3 (diff)
downloadfederated-compute-03688b21ee4a9735035ec61083ec68d6dd216f8b.tar.gz
Add new TaskAssignment http protocol.
Bug: 272574770 Test: mma Change-Id: I9c93fc660e920ddf22b13616ec7cc7bc621d3f11
-rw-r--r--Android.bp6
-rw-r--r--fcp/protos/federatedcompute/common.proto26
-rw-r--r--fcp/protos/ondevicepersonalization/task_assignments.proto115
3 files changed, 141 insertions, 6 deletions
diff --git a/Android.bp b/Android.bp
index c76bc8d..dadc331 100644
--- a/Android.bp
+++ b/Android.bp
@@ -47,13 +47,9 @@ java_library_static {
],
},
srcs: [
- "fcp/secagg/shared/secagg_messages.proto",
- "fcp/protos/federatedcompute/aggregations.proto",
- "fcp/protos/federatedcompute/eligibility_eval_tasks.proto",
- "fcp/protos/federatedcompute/task_assignments.proto",
+ "fcp/protos/ondevicepersonalization/task_assignments.proto",
"fcp/protos/federatedcompute/common.proto",
"fcp/protos/plan.proto",
- "fcp/protos/federated_api.proto",
"fcp/client/**/*.proto",
":libprotobuf-internal-protos",
],
diff --git a/fcp/protos/federatedcompute/common.proto b/fcp/protos/federatedcompute/common.proto
index e67bec9..dd57daa 100644
--- a/fcp/protos/federatedcompute/common.proto
+++ b/fcp/protos/federatedcompute/common.proto
@@ -114,7 +114,31 @@ enum ResourceCompressionFormat {
// Currently empty message which is sent when client (device) is rejected for
// participation and is not assigned a task.
-message RejectionInfo {}
+// Next id: 1003
+message RejectionInfo {
+
+ RejectionReason.Enum reason = 1001;
+
+ // Metadata for client to take next action.
+ oneof metadata {
+ // Retry after a period of time.
+ RetryWindow retry_window = 1002;
+ }
+}
+
+// Next id: 3
+message RejectionReason {
+ enum Enum {
+ // Unknown status.
+ UNKNOWN = 0;
+
+ // There is no available task to join.
+ NO_TASK_AVAILABLE = 1;
+
+ // No permission to do the operation.
+ UNAUTHORIZED = 2;
+ }
+}
// A suggestion to the client when to retry the connection to the service next
// time
diff --git a/fcp/protos/ondevicepersonalization/task_assignments.proto b/fcp/protos/ondevicepersonalization/task_assignments.proto
new file mode 100644
index 0000000..62e5e90
--- /dev/null
+++ b/fcp/protos/ondevicepersonalization/task_assignments.proto
@@ -0,0 +1,115 @@
+/**
+ * Copyright 2023 Google LLC
+ *
+ * <p>Licensed under the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License. You may obtain a
+ * copy of the License at
+ *
+ * <p>http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * <p>Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+syntax = "proto3";
+
+package google.ondevicepersonalization.federatedcompute.proto;
+
+import "fcp/protos/federatedcompute/common.proto";
+
+option java_package = "com.google.ondevicepersonalization.federatedcompute.proto";
+option java_multiple_files = true;
+
+// Create task assignment request.
+// The url to create task assignment under v1 API is:
+// https://{host}/taskassignment/v1/population/{populationName}:create-task-assignment
+// Next Id: 2
+message CreateTaskAssignmentRequest {
+ google.internal.federatedcompute.v1.ClientVersion client_version = 1;
+}
+
+// Create task assignment response.
+// Next Id: 3
+message CreateTaskAssignmentResponse {
+ // One of two outcomes, depending on server's decision on participation of the
+ // client.
+ oneof result {
+ // If the client joined the task with this call, information on how to
+ // proceed.
+ TaskAssignment task_assignment = 1;
+
+ // If the client was not accepted, information how to proceed.
+ google.internal.federatedcompute.v1.RejectionInfo rejection_info = 2;
+ }
+}
+
+// When client (device) is accepted for the current task, this data structure
+// carries information necessary to begin task execution.
+// Next Id: 9
+message TaskAssignment {
+ // population name.
+ string population_name = 1;
+
+ // the task id
+ string task_id = 2;
+
+ // The opaque id of the aggregation session the client has joined. This is a
+ // string generated by the server and MUST NOT contain any information that
+ // could be used to identify a specific device.
+ string aggregation_id = 3;
+
+ // assignment id
+ string assignment_id = 4;
+
+ // The name identifying the task that was assigned.
+ string task_name = 5;
+
+ // The checkpoint from which to start execution.
+ google.internal.federatedcompute.v1.Resource init_checkpoint = 6;
+
+ // The plan to be used for execution.
+ google.internal.federatedcompute.v1.Resource plan = 7;
+
+ // self uri
+ string self_uri = 8;
+}
+
+// Report result request.
+// The url to report result under v1 API is:
+// https://{host}/taskassignment/v1/population/{populationName}/task/{taskId}/aggregation/{aggregationId}/task-assignment/{assignmentId}:report-result
+// Next Id: 2
+message ReportResultRequest {
+ enum Result {
+ // Unknown
+ UNKNOWN = 0;
+
+ // Completed
+ COMPLETED = 1;
+
+ // Failed.
+ FAILED = 2;
+ }
+
+ Result result = 1;
+}
+
+// Report result response.
+message ReportResultResponse {
+ // Upload result instruction on succeeded.
+ UploadInstruction upload_instruction = 1;
+
+ // Rejection reason.
+ google.internal.federatedcompute.v1.RejectionInfo rejection_info = 2;
+}
+
+// The upload instruction.
+// Next id: 3
+message UploadInstruction {
+ // upload file path.
+ string upload_location = 1;
+
+ // extra head for uploading.
+ map<string, string> extra_request_headers = 2;
+}