From beabfbcfa68ea1c215235e8a4744e7a9c89466c6 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Fri, 6 Mar 2020 15:06:27 -0800 Subject: [PATCH] Populate more error messages to the users. PiperOrigin-RevId: 299445320 Change-Id: Ia0d02c25ac3254444f7293d60c912989ad77ee3c --- .../core/profiler/rpc/client/capture_profile.cc | 4 ++-- .../python/profiler/internal/profiler_wrapper.cc | 11 +++++------ 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/tensorflow/core/profiler/rpc/client/capture_profile.cc b/tensorflow/core/profiler/rpc/client/capture_profile.cc index c91675da971..4541e342804 100644 --- a/tensorflow/core/profiler/rpc/client/capture_profile.cc +++ b/tensorflow/core/profiler/rpc/client/capture_profile.cc @@ -97,8 +97,8 @@ Status Profile(const string& service_addr, const string& logdir, FromGrpcStatus(stub->Profile(&context, request, &response))); if (!response.empty_trace()) { - TF_CHECK_OK(SaveTensorboardProfile(logdir, session_id, request.host_name(), - response, &std::cout)); + TF_RETURN_IF_ERROR(SaveTensorboardProfile( + logdir, session_id, request.host_name(), response, &std::cout)); // Print this at the end so that it's not buried in irrelevant LOG messages. std::cout << "NOTE: using the trace duration " << duration_ms << "ms.\n" diff --git a/tensorflow/python/profiler/internal/profiler_wrapper.cc b/tensorflow/python/profiler/internal/profiler_wrapper.cc index dfc46a41f83..c7780b7dc01 100644 --- a/tensorflow/python/profiler/internal/profiler_wrapper.cc +++ b/tensorflow/python/profiler/internal/profiler_wrapper.cc @@ -70,16 +70,15 @@ class ProfilerSessionWrapper { tensorflow::Status status; status = session_->CollectData(&xspace); session_.reset(); - if (!status.ok()) { - tensorflow::MaybeRaiseRegisteredFromStatus(status); - return; - } + tensorflow::MaybeRaiseRegisteredFromStatus(status); + tensorflow::ProfileResponse response; tensorflow::ProfileRequest request = MakeProfileRequest( logdir_, tensorflow::profiler::GetCurrentTimeStampAsString(), tensorflow::port::Hostname()); - tensorflow::profiler::ConvertXSpaceToProfileResponse(xspace, request, - &response); + status = tensorflow::profiler::ConvertXSpaceToProfileResponse( + xspace, request, &response); + tensorflow::MaybeRaiseRegisteredFromStatus(status); std::stringstream ss; // Record LOG messages. status = tensorflow::profiler::SaveTensorboardProfile(