diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-03-15 17:53:55 +0100 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-03-19 10:31:33 +0100 |
commit | f3039bc31d32b27ba92fdc534c191acf889db302 (patch) | |
tree | 828d7c0cbf2b9b24e488dada2da8ae65d9e6e7f5 /src/buildtool/build_engine/target_map/export.cpp | |
parent | de99281c278153290f89c23b20f8afb2b57d97ee (diff) | |
download | justbuild-f3039bc31d32b27ba92fdc534c191acf889db302.tar.gz |
serve target: Differentiate between fatal and non-fatal orchestrated builds
...by increasing granularity in client-side reporting. This allows
to correctly continue with builds of local targets if the serve
endpoint does not have the requested target, as well as improve
the reporting for users on failure.
Diffstat (limited to 'src/buildtool/build_engine/target_map/export.cpp')
-rw-r--r-- | src/buildtool/build_engine/target_map/export.cpp | 40 |
1 files changed, 36 insertions, 4 deletions
diff --git a/src/buildtool/build_engine/target_map/export.cpp b/src/buildtool/build_engine/target_map/export.cpp index 3ed86dd1..b8b5b1db 100644 --- a/src/buildtool/build_engine/target_map/export.cpp +++ b/src/buildtool/build_engine/target_map/export.cpp @@ -135,11 +135,43 @@ void ExportRule( auto task = fmt::format( "[{},{}]", key.target.ToString(), effective_config.ToString()); exports_progress->TaskTracker().Start(task); - - target_cache_value = - ServeApi::ServeTarget(*target_cache_key, *repo_key); + auto res = ServeApi::ServeTarget(*target_cache_key, *repo_key); + // process response from serve endpoint + if (not res) { + // target not found: log to performance, and continue + Logger::Log(LogLevel::Performance, + "Export target {} not known to serve endpoint", + key.target.ToString()); + } + else { + if (res->index() == 0) { + // target found but failed to analyse/build: this should be + // a fatal error for the local build too + (*logger)( + fmt::format("Failure to remotely analyse or build " + "target {}\nDetailed log available on the " + "remote-execution endpoint as blob {}", + key.target.ToString(), + std::get<0>(*res)), + /*fatal=*/true); + return; + } + if (res->index() == 1) { + // some other failure occurred while querying the serve + // endpoint; log to debug and continue locally + Logger::Log(LogLevel::Debug, + "While querying serve endpoint for export " + "target {}:\n{}", + key.target.ToString(), + std::get<1>(*res)); + } + else { + // index == 2 + target_cache_value = std::get<2>(*res); + from_just_serve = true; + } + } exports_progress->TaskTracker().Stop(task); - from_just_serve = true; } #endif // BOOTSTRAP_BUILD_TOOL |