diff options
Diffstat (limited to 'src/buildtool/execution_api')
5 files changed, 61 insertions, 36 deletions
diff --git a/src/buildtool/execution_api/execution_service/TARGETS b/src/buildtool/execution_api/execution_service/TARGETS index cf84f076..eaaffcca 100644 --- a/src/buildtool/execution_api/execution_service/TARGETS +++ b/src/buildtool/execution_api/execution_service/TARGETS @@ -27,7 +27,9 @@ , ["src/buildtool/logging", "logging"] ] , "private-deps": - [["src/buildtool/execution_api/local", "garbage_collector"]] + [ ["src/buildtool/execution_api/local", "garbage_collector"] + , ["src/buildtool/compatibility", "compatibility"] + ] } , "cas_server": { "type": ["@", "rules", "CC", "library"] diff --git a/src/buildtool/execution_api/execution_service/ac_server.cpp b/src/buildtool/execution_api/execution_service/ac_server.cpp index 1b5b9470..40407711 100644 --- a/src/buildtool/execution_api/execution_service/ac_server.cpp +++ b/src/buildtool/execution_api/execution_service/ac_server.cpp @@ -15,6 +15,7 @@ #include "src/buildtool/execution_api/execution_service/ac_server.hpp" #include "fmt/format.h" +#include "src/buildtool/compatibility/native_support.hpp" #include "src/buildtool/execution_api/local/garbage_collector.hpp" auto ActionCacheServiceImpl::GetActionResult( @@ -25,7 +26,7 @@ auto ActionCacheServiceImpl::GetActionResult( -> ::grpc::Status { logger_.Emit(LogLevel::Trace, "GetActionResult: {}", - request->action_digest().hash()); + NativeSupport::Unprefix(request->action_digest().hash())); auto lock = GarbageCollector::SharedLock(); if (!lock) { auto str = fmt::format("Could not acquire SharedLock"); @@ -34,9 +35,10 @@ auto ActionCacheServiceImpl::GetActionResult( } auto x = ac_.CachedResult(request->action_digest()); if (!x) { - return grpc::Status{ - grpc::StatusCode::NOT_FOUND, - fmt::format("{} missing from AC", request->action_digest().hash())}; + return grpc::Status{grpc::StatusCode::NOT_FOUND, + fmt::format("{} missing from AC", + NativeSupport::Unprefix( + request->action_digest().hash()))}; } *response = *x; return ::grpc::Status::OK; diff --git a/src/buildtool/execution_api/execution_service/cas_server.cpp b/src/buildtool/execution_api/execution_service/cas_server.cpp index 025a6757..3afde937 100644 --- a/src/buildtool/execution_api/execution_service/cas_server.cpp +++ b/src/buildtool/execution_api/execution_service/cas_server.cpp @@ -32,7 +32,9 @@ auto CASServiceImpl::FindMissingBlobs( } for (auto const& x : request->blob_digests()) { auto const& hash = x.hash(); - logger_.Emit(LogLevel::Trace, "FindMissingBlobs: {}", hash); + logger_.Emit(LogLevel::Trace, + "FindMissingBlobs: {}", + NativeSupport::Unprefix(hash)); if (NativeSupport::IsTree(hash)) { if (!storage_.TreePath(x)) { auto* d = response->add_missing_blob_digests(); @@ -61,20 +63,24 @@ auto CASServiceImpl::BatchUpdateBlobs( } for (auto const& x : request->requests()) { auto const& hash = x.digest().hash(); - logger_.Emit(LogLevel::Trace, "BatchUpdateBlobs: {}", hash); + logger_.Emit(LogLevel::Trace, + "BatchUpdateBlobs: {}", + NativeSupport::Unprefix(hash)); auto* r = response->add_responses(); r->mutable_digest()->CopyFrom(x.digest()); if (NativeSupport::IsTree(hash)) { if (!storage_.StoreTree(x.data())) { - auto const& str = fmt::format( - "BatchUpdateBlobs: could not upload tree {}", hash); + auto const& str = + fmt::format("BatchUpdateBlobs: could not upload tree {}", + NativeSupport::Unprefix(hash)); logger_.Emit(LogLevel::Error, str); return ::grpc::Status{grpc::StatusCode::INTERNAL, str}; } } else if (!storage_.StoreBlob(x.data(), false)) { auto const& str = - fmt::format("BatchUpdateBlobs: could not upload blob {}", hash); + fmt::format("BatchUpdateBlobs: could not upload blob {}", + NativeSupport::Unprefix(hash)); logger_.Emit(LogLevel::Error, str); return ::grpc::Status{grpc::StatusCode::INTERNAL, str}; } diff --git a/src/buildtool/execution_api/execution_service/execution_server.cpp b/src/buildtool/execution_api/execution_service/execution_server.cpp index 2b2aa681..6d4f791d 100644 --- a/src/buildtool/execution_api/execution_service/execution_server.cpp +++ b/src/buildtool/execution_api/execution_service/execution_server.cpp @@ -21,6 +21,7 @@ #include <utility> #include "fmt/format.h" +#include "src/buildtool/compatibility/native_support.hpp" #include "src/buildtool/execution_api/local/garbage_collector.hpp" auto ExecutionServiceImpl::GetAction( @@ -31,8 +32,9 @@ auto ExecutionServiceImpl::GetAction( // get action description auto path = storage_.BlobPath(request->action_digest(), false); if (!path) { - auto str = fmt::format("could not retrieve blob {} from cas", - request->action_digest().hash()); + auto str = fmt::format( + "could not retrieve blob {} from cas", + NativeSupport::Unprefix(request->action_digest().hash())); logger_.Emit(LogLevel::Error, str); return {std::nullopt, str}; } @@ -40,8 +42,9 @@ auto ExecutionServiceImpl::GetAction( { std::ifstream f(*path); if (!action.ParseFromIstream(&f)) { - auto str = fmt::format("failed to parse action from blob {}", - request->action_digest().hash()); + auto str = fmt::format( + "failed to parse action from blob {}", + NativeSupport::Unprefix(request->action_digest().hash())); logger_.Emit(LogLevel::Error, str); return {std::nullopt, str}; } @@ -52,8 +55,9 @@ auto ExecutionServiceImpl::GetAction( : storage_.TreePath(action.input_root_digest()); if (!path) { - auto str = fmt::format("could not retrieve input root {} from cas", - action.input_root_digest().hash()); + auto str = fmt::format( + "could not retrieve input root {} from cas", + NativeSupport::Unprefix(action.input_root_digest().hash())); logger_.Emit(LogLevel::Error, str); return {std::nullopt, str}; } @@ -67,8 +71,9 @@ auto ExecutionServiceImpl::GetCommand( auto path = storage_.BlobPath(action.command_digest(), false); if (!path) { - auto str = fmt::format("could not retrieve blob {} from cas", - action.command_digest().hash()); + auto str = fmt::format( + "could not retrieve blob {} from cas", + NativeSupport::Unprefix(action.command_digest().hash())); logger_.Emit(LogLevel::Error, str); return {std::nullopt, str}; } @@ -77,8 +82,9 @@ auto ExecutionServiceImpl::GetCommand( { std::ifstream f(*path); if (!c.ParseFromIstream(&f)) { - auto str = fmt::format("failed to parse command from blob {}", - action.command_digest().hash()); + auto str = fmt::format( + "failed to parse command from blob {}", + NativeSupport::Unprefix(action.command_digest().hash())); logger_.Emit(LogLevel::Error, str); return {std::nullopt, str}; } @@ -119,8 +125,9 @@ auto ExecutionServiceImpl::GetIExecutionAction( env_vars, {}); if (!i_execution_action) { - auto str = fmt::format("could not create action from {}", - request->action_digest().hash()); + auto str = fmt::format( + "could not create action from {}", + NativeSupport::Unprefix(request->action_digest().hash())); logger_.Emit(LogLevel::Error, str); return {std::nullopt, str}; } @@ -162,7 +169,8 @@ static void AddOutputPaths( auto ExecutionServiceImpl::AddResult( ::build::bazel::remote::execution::v2::ExecuteResponse* response, IExecutionResponse::Ptr const& i_execution_response, - std::string const& hash) const noexcept -> std::optional<std::string> { + std::string const& action_hash) const noexcept + -> std::optional<std::string> { AddOutputPaths(response, i_execution_response); auto* result = response->mutable_result(); result->set_exit_code(i_execution_response->ExitCode()); @@ -170,7 +178,8 @@ auto ExecutionServiceImpl::AddResult( auto dgst = storage_.StoreBlob(i_execution_response->StdErr(), /*is_executable=*/false); if (!dgst) { - auto str = fmt::format("Could not store stderr of action {}", hash); + auto str = + fmt::format("Could not store stderr of action {}", action_hash); logger_.Emit(LogLevel::Error, str); return str; } @@ -180,7 +189,8 @@ auto ExecutionServiceImpl::AddResult( auto dgst = storage_.StoreBlob(i_execution_response->StdOut(), /*is_executable=*/false); if (!dgst) { - auto str = fmt::format("Could not store stdout of action {}", hash); + auto str = + fmt::format("Could not store stdout of action {}", action_hash); logger_.Emit(LogLevel::Error, str); return str; } @@ -206,8 +216,10 @@ auto ExecutionServiceImpl::GetResponse( ::build::bazel::remote::execution::v2::ExecuteResponse response{}; AddStatus(&response); - auto err = AddResult( - &response, i_execution_response, request->action_digest().hash()); + auto err = + AddResult(&response, + i_execution_response, + NativeSupport::Unprefix(request->action_digest().hash())); if (err) { return {std::nullopt, *err}; } @@ -224,7 +236,6 @@ auto ExecutionServiceImpl::WriteResponse( auto [execute_response, msg_r] = GetResponse(request, i_execution_response); if (!execute_response) { - return *msg_r; } @@ -232,8 +243,9 @@ auto ExecutionServiceImpl::WriteResponse( if (i_execution_response->ExitCode() == 0 && !action.do_not_cache() && !storage_.StoreActionResult(request->action_digest(), execute_response->result())) { - auto str = fmt::format("Could not store action result for action {}", - request->action_digest().hash()); + auto str = fmt::format( + "Could not store action result for action {}", + NativeSupport::Unprefix(request->action_digest().hash())); logger_.Emit(LogLevel::Error, str); return str; } @@ -244,9 +256,9 @@ auto ExecutionServiceImpl::WriteResponse( op.set_name("just-remote-execution"); op.set_done(true); if (!writer->Write(op)) { - auto str = - fmt::format("Could not write execution response for action {}", - request->action_digest().hash()); + auto str = fmt::format( + "Could not write execution response for action {}", + NativeSupport::Unprefix(request->action_digest().hash())); logger_.Emit(LogLevel::Error, str); return str; } @@ -274,11 +286,13 @@ auto ExecutionServiceImpl::Execute( return ::grpc::Status{grpc::StatusCode::INTERNAL, *msg}; } - logger_.Emit(LogLevel::Info, "Execute {}", request->action_digest().hash()); + logger_.Emit(LogLevel::Info, + "Execute {}", + NativeSupport::Unprefix(request->action_digest().hash())); auto i_execution_response = i_execution_action->get()->Execute(&logger_); logger_.Emit(LogLevel::Trace, "Finished execution of {}", - request->action_digest().hash()); + NativeSupport::Unprefix(request->action_digest().hash())); auto err = WriteResponse(request, i_execution_response, *action, writer); if (err) { return ::grpc::Status{grpc::StatusCode::INTERNAL, *err}; diff --git a/src/buildtool/execution_api/local/local_action.cpp b/src/buildtool/execution_api/local/local_action.cpp index 4d08f7fe..414773c2 100644 --- a/src/buildtool/execution_api/local/local_action.cpp +++ b/src/buildtool/execution_api/local/local_action.cpp @@ -19,6 +19,7 @@ #include "gsl-lite/gsl-lite.hpp" #include "src/buildtool/common/bazel_types.hpp" +#include "src/buildtool/compatibility/native_support.hpp" #include "src/buildtool/execution_api/local/local_response.hpp" #include "src/buildtool/file_system/file_system_manager.hpp" #include "src/buildtool/file_system/object_type.hpp" @@ -60,7 +61,7 @@ auto LocalAction::Execute(Logger const* logger) noexcept " - exec_dir digest: {}\n" " - action digest: {}", root_digest_.hash(), - action.hash()); + NativeSupport::Unprefix(action.hash())); } if (do_cache) { |