aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorqiaoli <qiaoli@google.com>2023-07-27 18:21:39 +0000
committerqiaoli <qiaoli@google.com>2023-07-27 19:26:26 +0000
commit87f3cd15448265adcf01c8198e1f19f72995919d (patch)
treed1e75ec6810c8d06b1f17ea08dc7a5dad7c4b531
parent3b849307dbdfc75c68ce8918d0a5663c13fab379 (diff)
downloadfederated-compute-87f3cd15448265adcf01c8198e1f19f72995919d.tar.gz
Add debug error message and a few fixes in fcp
Test: atest Bug: 281758731 Change-Id: I6ca5a4acc9bc1057bcd4cfeaa4ab0ff113cf763a
-rw-r--r--Android.bp4
-rw-r--r--fcp/client/engine/example_query_plan_engine_test.cc4
-rw-r--r--fcp/client/fcp_runner.cc3
-rw-r--r--fcp/client/fl_runner.proto4
-rw-r--r--fcp/protos/plan.proto3
-rw-r--r--fcp/tensorflow/file_descriptor_filesystem_test.cc2
6 files changed, 16 insertions, 4 deletions
diff --git a/Android.bp b/Android.bp
index cb41fc7..c76bc8d 100644
--- a/Android.bp
+++ b/Android.bp
@@ -116,7 +116,9 @@ cc_library_static {
exclude_srcs: [
"fcp/**/*test*.cc",
"fcp/client/fake_*.cc",
- "fcp/client/engine/tf_*.cc",
+ // Exclude tfmobile engine dependencies.
+ "fcp/client/engine/tf_wrapper.cc",
+ "fcp/client/engine/simple_plan_engine.cc",
"fcp/tensorflow/tf_session.cc",
],
static_libs: [
diff --git a/fcp/client/engine/example_query_plan_engine_test.cc b/fcp/client/engine/example_query_plan_engine_test.cc
index 638e861..a64ada3 100644
--- a/fcp/client/engine/example_query_plan_engine_test.cc
+++ b/fcp/client/engine/example_query_plan_engine_test.cc
@@ -267,7 +267,7 @@ TEST_F(ExampleQueryPlanEngineTest, PlanSucceeds) {
EXPECT_THAT(result.outcome, PlanOutcome::kSuccess);
auto tensors = ReadTensors(output_checkpoint_filename_);
- // ASSERT_OK(tensors);
+ ASSERT_TRUE(tensors.ok());
tf::Tensor int_tensor = tensors.value()[kOutputIntTensorName];
ASSERT_EQ(int_tensor.shape(), tf::TensorShape({2}));
ASSERT_EQ(int_tensor.dtype(), tf::DT_INT64);
@@ -360,7 +360,7 @@ TEST_F(ExampleQueryPlanEngineTest, MultipleQueries) {
auto tensors = ReadTensors(output_checkpoint_filename_);
// ASSERT_OK is not supported in AOSP.
- // ASSERT_OK(tensors);
+ ASSERT_TRUE(tensors.ok());
tf::Tensor int_tensor = tensors.value()[kOutputIntTensorName];
ASSERT_EQ(int_tensor.shape(), tf::TensorShape({2}));
ASSERT_EQ(int_tensor.dtype(), tf::DT_INT64);
diff --git a/fcp/client/fcp_runner.cc b/fcp/client/fcp_runner.cc
index 8b645d5..51e1618 100644
--- a/fcp/client/fcp_runner.cc
+++ b/fcp/client/fcp_runner.cc
@@ -280,6 +280,9 @@ absl::StatusOr<FLRunnerResult> RunFederatedComputation(
fl_runner_result.set_contribution_result(FLRunnerResult::SUCCESS);
} else {
fl_runner_result.set_contribution_result(FLRunnerResult::FAIL);
+ std::string error_message = std::string{
+ plan_result_and_checkpoint_file.plan_result.original_status.message()};
+ fl_runner_result.set_error_message(error_message);
}
return fl_runner_result;
}
diff --git a/fcp/client/fl_runner.proto b/fcp/client/fl_runner.proto
index 849630f..55d22f5 100644
--- a/fcp/client/fl_runner.proto
+++ b/fcp/client/fl_runner.proto
@@ -45,6 +45,10 @@ message FLRunnerResult {
}
ContributionResult contribution_result = 5;
+
+ // Debug message will be present if ContributionResult is FAIL.
+ string error_message = 6;
+
reserved 2, 3;
}
diff --git a/fcp/protos/plan.proto b/fcp/protos/plan.proto
index 5c606c9..81076f4 100644
--- a/fcp/protos/plan.proto
+++ b/fcp/protos/plan.proto
@@ -497,6 +497,9 @@ message TensorflowSpec {
// Note: tensors specified via this message should not be included in
// input_tensor_specs.
map<string, tensorflow.TensorProto> constant_inputs = 5;
+
+ // Specifies an example selection procedure.
+ ExampleSelector example_selector = 6;
}
// ExampleQuerySpec message describes client execution that issues example
diff --git a/fcp/tensorflow/file_descriptor_filesystem_test.cc b/fcp/tensorflow/file_descriptor_filesystem_test.cc
index 53ed024..669f822 100644
--- a/fcp/tensorflow/file_descriptor_filesystem_test.cc
+++ b/fcp/tensorflow/file_descriptor_filesystem_test.cc
@@ -28,7 +28,7 @@ class FileDescriptorFileSystemTest : public ::testing::Test {
protected:
void TearDown() override {
if (fd_ != -1) {
- close(fd_);
+ ASSERT_NE(-1, close(fd_));
}
}