xref: /aosp_15_r20/external/federated-compute/fcp/client/fl_runner.proto (revision 14675a029014e728ec732f129a32e299b2da0601)
1/*
2 * Copyright 2020 Google LLC
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16syntax = "proto3";
17
18package fcp.client;
19
20import "google/protobuf/duration.proto";
21import "fcp/client/engine/engine.proto";
22import "tensorflow/core/framework/tensor.proto";
23
24option java_package = "com.google.intelligence.fcp.client";
25option java_multiple_files = true;
26
27/**
28 * This protocol buffer is used to report results and statistics of a Federated
29 * Computation - including checking in with the server, running a plan, and
30 * reporting back results - to the caller. It is a protocol buffer to support
31 * sending it across language boundaries.
32 */
33message FLRunnerResult {
34  reserved 1;
35  // A RetryInfo returned to the caller for consideration in scheduling future
36  // runs of this task.
37  RetryInfo retry_info = 4;
38  // An enum that summarizes whether the client has contributed to an FL/FA
39  // round.
40  enum ContributionResult {
41    UNSPECIFIED = 0;
42    SUCCESS = 1;
43    // Any outcome that is not a success.
44    FAIL = 2;
45  }
46
47  ContributionResult contribution_result = 5;
48  reserved 2, 3;
49
50
51  // All fields below are added by OnDevicePersonalization module for logging and
52  // debugging purpose.
53  // Debug message will be present if ContributionResult is FAIL.
54  string error_message = 200;
55
56  enum ErrorStatus {
57    ERROR_STATUS_UNSPECIFIED = 0;
58    // A TensorFlow error occurred.
59    TENSORFLOW_ERROR = 1;
60    // The input parameters are invalid.
61    INVALID_ARGUMENT = 2;
62    // An example iterator error occurred.
63    EXAMPLE_ITERATOR_ERROR = 3;
64    // Not eligible to execute task.
65    NOT_ELIGIBLE = 4;
66  }
67
68  // Used to populate error happens in c++ to java code. Mainly for debug and
69  // logging purpose.
70  ErrorStatus error_status = 201;
71
72  message ExampleStats {
73    // For TensorlowSpec-based plans, this refers to the overall number of
74    // elements returned by all ExampleIterator::Next() calls. For
75    // ExampleQuerySpec-based plans, this refers to the total number of row counts
76    // calculated at example store layer and passed via ExampleQueryResults.
77    int32 example_count = 1;
78    int64 example_size_bytes = 2;
79  }
80
81  // Used to record the stats of examples used in computation. Mainly used for
82  // debug and logging purpose.
83  ExampleStats example_stats = 202;
84}
85
86// A suggestion to the client when to retry the connection to the service next
87// time
88message RetryInfo {
89  // Optional. If set, should be provided back to the next
90  // RunFederatedComputation invocation.
91  string retry_token = 1;
92
93  // The suggested delay duration after which the client should
94  // retry. Clients should ideally not retry any earlier than this.
95  google.protobuf.Duration minimum_delay = 2;
96}
97
98/**
99 * This protocol buffer is used to pass TensorflowSpec-based plan outputs across
100 * the JNI boundary so they can be accessed in compatibility tests.
101 */
102message FLRunnerTensorflowSpecResult {
103  // The outcome of running the plan.
104  engine.PhaseOutcome outcome = 1;
105  // The location of the output checkpoint file, if one was created.
106  string checkpoint_output_filename = 2;
107  // A map of output tensor names and values, if any.
108  map<string, tensorflow.TensorProto> output_tensors = 3;
109}
110