diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-03-06 15:47:27 +0100 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-03-07 10:04:35 +0100 |
commit | 05f3f2c1c0d0d39562fee09afd201b7bc9a9db4b (patch) | |
tree | 89c20a85d85b5cbd8d28d39628b20a487e9833d3 /src/buildtool/execution_api/remote/bazel/bazel_api.cpp | |
parent | d6b7f3373dcffdf406cd15887a6fba5e70e277cb (diff) | |
download | justbuild-05f3f2c1c0d0d39562fee09afd201b7bc9a9db4b.tar.gz |
Down-level log message for errors that can be handled
We deliberately have many functions that do not abort the process
on failure and instead simply return a corresponding value. It
is then up to the caller to decide how to handle this failure;
in particular, such a failure can be expected, e.g., if we try to
fetch a file from remote execution first, before fetching it from
the upstream location.
To have a consistent user experience, nothing that can occur in
a successfull build should be reported at error level; moreover,
messages that routinely occur during successfull builds should not
be reported at progress or above, except for the (stage) result
messages and the progress reporter.
Diffstat (limited to 'src/buildtool/execution_api/remote/bazel/bazel_api.cpp')
-rw-r--r-- | src/buildtool/execution_api/remote/bazel/bazel_api.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/buildtool/execution_api/remote/bazel/bazel_api.cpp b/src/buildtool/execution_api/remote/bazel/bazel_api.cpp index bfc42083..994d2b43 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_api.cpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_api.cpp @@ -76,7 +76,8 @@ namespace { BlobContainer container{}; while (not blobs.empty()) { if (count + blobs.size() > size) { - Logger::Log(LogLevel::Error, "received more blobs than requested."); + Logger::Log(LogLevel::Warning, + "received more blobs than requested."); return false; } for (auto const& blob : blobs) { @@ -88,7 +89,7 @@ namespace { container.Emplace(BazelBlob{blob.digest, blob.data, exec}); } catch (std::exception const& ex) { Logger::Log( - LogLevel::Error, "failed to emplace blob: ", ex.what()); + LogLevel::Warning, "failed to emplace blob: ", ex.what()); return false; } } @@ -97,7 +98,7 @@ namespace { } if (count != size) { - Logger::Log(LogLevel::Error, "could not retrieve all requested blobs."); + Logger::Log(LogLevel::Debug, "could not retrieve all requested blobs."); return false; } @@ -210,7 +211,7 @@ auto BazelApi::CreateAction( std::optional<gsl::not_null<IExecutionApi*>> const& alternative) noexcept -> bool { if (artifacts_info.size() != output_paths.size()) { - Logger::Log(LogLevel::Error, + Logger::Log(LogLevel::Warning, "different number of digests and output paths."); return false; } @@ -250,7 +251,8 @@ auto BazelApi::CreateAction( std::size_t count{}; while (not blobs.empty()) { if (count + blobs.size() > size) { - Logger::Log(LogLevel::Error, "received more blobs than requested."); + Logger::Log(LogLevel::Warning, + "received more blobs than requested."); return false; } for (std::size_t pos = 0; pos < blobs.size(); ++pos) { @@ -259,7 +261,7 @@ auto BazelApi::CreateAction( if (not FileSystemManager::WriteFileAs</*kSetEpochTime=*/true, /*kSetWritable=*/true>( blobs[pos].data, output_paths[gpos], type)) { - Logger::Log(LogLevel::Error, + Logger::Log(LogLevel::Warning, "staging to output path {} failed.", output_paths[gpos].string()); return false; @@ -270,7 +272,8 @@ auto BazelApi::CreateAction( } if (count != size) { - Logger::Log(LogLevel::Error, "could not retrieve all requested blobs."); + Logger::Log(LogLevel::Warning, + "could not retrieve all requested blobs."); return false; } @@ -282,7 +285,7 @@ auto BazelApi::CreateAction( std::vector<int> const& fds, bool raw_tree) noexcept -> bool { if (artifacts_info.size() != fds.size()) { - Logger::Log(LogLevel::Error, + Logger::Log(LogLevel::Warning, "different number of digests and file descriptors."); return false; } @@ -295,7 +298,7 @@ auto BazelApi::CreateAction( auto const success = network_->DumpToStream(info, out, raw_tree); std::fclose(out); if (not success) { - Logger::Log(LogLevel::Error, + Logger::Log(LogLevel::Warning, "dumping {} {} to file descriptor {} failed.", IsTreeObject(info.type) ? "tree" : "blob", info.ToString(), @@ -305,7 +308,7 @@ auto BazelApi::CreateAction( } else { Logger::Log( - LogLevel::Error, "opening file descriptor {} failed.", fd); + LogLevel::Warning, "opening file descriptor {} failed.", fd); return false; } } @@ -416,8 +419,9 @@ auto BazelApi::CreateAction( }); } } catch (std::exception const& ex) { - Logger::Log( - LogLevel::Error, "Artifact synchronization failed: {}", ex.what()); + Logger::Log(LogLevel::Warning, + "Artifact synchronization failed: {}", + ex.what()); return false; } |