diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-07-16 17:42:40 +0200 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-07-19 09:50:37 +0200 |
commit | 4e2e6585441cc69b2c2ebc29b9ca95e1804b5053 (patch) | |
tree | 67a093af0987a6347a50a0d04cbd6c382ca70957 | |
parent | f2af767908e42013664e30ec40c431c41a6895c1 (diff) | |
download | justbuild-4e2e6585441cc69b2c2ebc29b9ca95e1804b5053.tar.gz |
Pass RetryConfig instance to BazelApi
11 files changed, 30 insertions, 9 deletions
diff --git a/src/buildtool/execution_api/common/TARGETS b/src/buildtool/execution_api/common/TARGETS index a96727ab..01c152c8 100644 --- a/src/buildtool/execution_api/common/TARGETS +++ b/src/buildtool/execution_api/common/TARGETS @@ -51,7 +51,8 @@ , ["src/buildtool/storage", "storage"] ] , "private-deps": - [ ["src/buildtool/execution_api/bazel_msg", "bazel_msg"] + [ ["src/buildtool/common/remote", "retry_config"] + , ["src/buildtool/execution_api/bazel_msg", "bazel_msg"] , ["src/buildtool/execution_api/local", "local"] , ["src/buildtool/execution_api/remote", "bazel"] ] diff --git a/src/buildtool/execution_api/common/api_bundle.cpp b/src/buildtool/execution_api/common/api_bundle.cpp index 7cb307eb..ba4a434c 100644 --- a/src/buildtool/execution_api/common/api_bundle.cpp +++ b/src/buildtool/execution_api/common/api_bundle.cpp @@ -14,6 +14,7 @@ #include "src/buildtool/execution_api/common/api_bundle.hpp" +#include "src/buildtool/common/remote/retry_config.hpp" #include "src/buildtool/execution_api/bazel_msg/bazel_common.hpp" #include "src/buildtool/execution_api/local/local_api.hpp" #include "src/buildtool/execution_api/remote/bazel/bazel_api.hpp" @@ -38,8 +39,12 @@ auto ApiBundle::CreateRemote(std::optional<ServerAddress> const& address) const if (address) { ExecutionConfiguration config; config.skip_cache_lookup = false; - return std::make_shared<BazelApi>( - "remote-execution", address->host, address->port, &auth, config); + return std::make_shared<BazelApi>("remote-execution", + address->host, + address->port, + &auth, + &RetryConfig::Instance(), + config); } return local; } diff --git a/src/buildtool/execution_api/remote/TARGETS b/src/buildtool/execution_api/remote/TARGETS index e8df48db..ad4093f3 100644 --- a/src/buildtool/execution_api/remote/TARGETS +++ b/src/buildtool/execution_api/remote/TARGETS @@ -67,12 +67,13 @@ , "srcs": ["bazel/bazel_api.cpp"] , "deps": [ "config" - , ["src/buildtool/auth", "auth"] - , ["src/buildtool/execution_api/common", "common"] - , ["src/buildtool/execution_api/bazel_msg", "bazel_msg"] , ["@", "gsl", "", "gsl"] + , ["src/buildtool/auth", "auth"] , ["src/buildtool/common", "common"] , ["src/buildtool/common/remote", "port"] + , ["src/buildtool/common/remote", "retry_config"] + , ["src/buildtool/execution_api/bazel_msg", "bazel_msg"] + , ["src/buildtool/execution_api/common", "common"] , ["src/buildtool/execution_api/common", "common_api"] ] , "stage": ["src", "buildtool", "execution_api", "remote"] @@ -80,7 +81,6 @@ [ "bazel_network" , ["@", "fmt", "", "fmt"] , ["src/buildtool/auth", "auth"] - , ["src/buildtool/common/remote", "retry_config"] , ["src/buildtool/compatibility", "compatibility"] , ["src/buildtool/multithreading", "task_system"] , ["src/buildtool/execution_api/common", "common"] diff --git a/src/buildtool/execution_api/remote/bazel/bazel_api.cpp b/src/buildtool/execution_api/remote/bazel/bazel_api.cpp index fd109003..f3635a5f 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_api.cpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_api.cpp @@ -27,7 +27,6 @@ #include "fmt/core.h" #include "src/buildtool/auth/authentication.hpp" #include "src/buildtool/common/bazel_types.hpp" -#include "src/buildtool/common/remote/retry_config.hpp" #include "src/buildtool/compatibility/compatibility.hpp" #include "src/buildtool/execution_api/bazel_msg/bazel_blob_container.hpp" #include "src/buildtool/execution_api/bazel_msg/bazel_common.hpp" @@ -193,9 +192,10 @@ BazelApi::BazelApi(std::string const& instance_name, std::string const& host, Port port, gsl::not_null<Auth const*> const& auth, + gsl::not_null<RetryConfig const*> const& retry_config, ExecutionConfiguration const& exec_config) noexcept { network_ = std::make_shared<BazelNetwork>( - instance_name, host, port, auth, &RetryConfig::Instance(), exec_config); + instance_name, host, port, auth, retry_config, exec_config); } // implement move constructor in cpp, where all members are complete types diff --git a/src/buildtool/execution_api/remote/bazel/bazel_api.hpp b/src/buildtool/execution_api/remote/bazel/bazel_api.hpp index 8a0ddcf9..5307ffd0 100644 --- a/src/buildtool/execution_api/remote/bazel/bazel_api.hpp +++ b/src/buildtool/execution_api/remote/bazel/bazel_api.hpp @@ -28,6 +28,7 @@ #include "src/buildtool/common/artifact.hpp" #include "src/buildtool/common/artifact_digest.hpp" #include "src/buildtool/common/remote/port.hpp" +#include "src/buildtool/common/remote/retry_config.hpp" #include "src/buildtool/execution_api/bazel_msg/bazel_common.hpp" #include "src/buildtool/execution_api/common/blob_tree.hpp" #include "src/buildtool/execution_api/common/execution_api.hpp" @@ -44,6 +45,7 @@ class BazelApi final : public IExecutionApi { std::string const& host, Port port, gsl::not_null<Auth const*> const& auth, + gsl::not_null<RetryConfig const*> const& retry_config, ExecutionConfiguration const& exec_config) noexcept; BazelApi(BazelApi const&) = delete; BazelApi(BazelApi&& other) noexcept; diff --git a/src/buildtool/execution_engine/executor/TARGETS b/src/buildtool/execution_engine/executor/TARGETS index 7a7718dd..2956b33f 100644 --- a/src/buildtool/execution_engine/executor/TARGETS +++ b/src/buildtool/execution_engine/executor/TARGETS @@ -8,6 +8,7 @@ , ["src/buildtool/common", "common"] , ["src/buildtool/common", "config"] , ["src/buildtool/common", "tree"] + , ["src/buildtool/common/remote", "retry_config"] , ["src/buildtool/compatibility", "compatibility"] , ["src/buildtool/file_system", "file_system_manager"] , ["src/buildtool/execution_engine/dag", "dag"] diff --git a/src/buildtool/execution_engine/executor/executor.hpp b/src/buildtool/execution_engine/executor/executor.hpp index e04a2948..77b6800f 100644 --- a/src/buildtool/execution_engine/executor/executor.hpp +++ b/src/buildtool/execution_engine/executor/executor.hpp @@ -31,6 +31,7 @@ #include "src/buildtool/auth/authentication.hpp" #include "src/buildtool/common/artifact_digest.hpp" #include "src/buildtool/common/remote/remote_common.hpp" +#include "src/buildtool/common/remote/retry_config.hpp" #include "src/buildtool/common/repository_config.hpp" #include "src/buildtool/common/statistics.hpp" #include "src/buildtool/common/tree.hpp" @@ -686,6 +687,7 @@ class ExecutorImpl { endpoint.host, endpoint.port, auth, + &RetryConfig::Instance(), config); } } diff --git a/test/buildtool/execution_api/bazel/TARGETS b/test/buildtool/execution_api/bazel/TARGETS index e94aed9a..eb888328 100644 --- a/test/buildtool/execution_api/bazel/TARGETS +++ b/test/buildtool/execution_api/bazel/TARGETS @@ -101,6 +101,7 @@ , ["utils", "catch-main-remote-execution"] , ["utils", "test_auth_config"] , ["utils", "test_remote_config"] + , ["@", "src", "src/buildtool/common/remote", "retry_config"] , ["@", "src", "src/buildtool/execution_api/remote", "bazel"] , ["buildtool/execution_api/common", "api_test"] ] diff --git a/test/buildtool/execution_api/bazel/bazel_api.test.cpp b/test/buildtool/execution_api/bazel/bazel_api.test.cpp index 9b9e6def..2674ee1f 100644 --- a/test/buildtool/execution_api/bazel/bazel_api.test.cpp +++ b/test/buildtool/execution_api/bazel/bazel_api.test.cpp @@ -16,6 +16,7 @@ #include <string> #include "catch2/catch_test_macros.hpp" +#include "src/buildtool/common/remote/retry_config.hpp" #include "src/buildtool/execution_api/remote/bazel/bazel_api.hpp" #include "src/buildtool/execution_api/remote/config.hpp" #include "test/buildtool/execution_api/common/api_test.hpp" @@ -34,6 +35,7 @@ auto const kApiFactory = []() { remote_config->remote_address->host, remote_config->remote_address->port, &*auth_config, + &RetryConfig::Instance(), {}}}; }; diff --git a/test/buildtool/execution_engine/executor/TARGETS b/test/buildtool/execution_engine/executor/TARGETS index ab5c197a..3ac12f80 100644 --- a/test/buildtool/execution_engine/executor/TARGETS +++ b/test/buildtool/execution_engine/executor/TARGETS @@ -69,6 +69,7 @@ [ "executor_api_tests" , ["@", "src", "src/buildtool/common", "common"] , ["@", "src", "src/buildtool/common", "config"] + , ["@", "src", "src/buildtool/common/remote", "retry_config"] , ["@", "src", "src/buildtool/execution_api/remote", "bazel"] , ["@", "src", "src/buildtool/execution_api/remote", "config"] , ["@", "src", "src/buildtool/execution_engine/executor", "executor"] diff --git a/test/buildtool/execution_engine/executor/executor_api_remote_bazel.test.cpp b/test/buildtool/execution_engine/executor/executor_api_remote_bazel.test.cpp index 26054283..424745de 100755 --- a/test/buildtool/execution_engine/executor/executor_api_remote_bazel.test.cpp +++ b/test/buildtool/execution_engine/executor/executor_api_remote_bazel.test.cpp @@ -15,6 +15,7 @@ #include <optional> #include "catch2/catch_test_macros.hpp" +#include "src/buildtool/common/remote/retry_config.hpp" #include "src/buildtool/common/repository_config.hpp" #include "src/buildtool/common/statistics.hpp" #include "src/buildtool/execution_api/remote/bazel/bazel_api.hpp" @@ -41,6 +42,7 @@ TEST_CASE("Executor<BazelApi>: Upload blob", "[executor]") { remote_config->remote_address->host, remote_config->remote_address->port, &*auth_config, + &RetryConfig::Instance(), config}}; }); } @@ -69,6 +71,7 @@ TEST_CASE("Executor<BazelApi>: Compile hello world", "[executor]") { remote_config->remote_address->host, remote_config->remote_address->port, &*auth_config, + &RetryConfig::Instance(), config}}; }, &*auth_config, @@ -99,6 +102,7 @@ TEST_CASE("Executor<BazelApi>: Compile greeter", "[executor]") { remote_config->remote_address->host, remote_config->remote_address->port, &*auth_config, + &RetryConfig::Instance(), config}}; }, &*auth_config, @@ -129,6 +133,7 @@ TEST_CASE("Executor<BazelApi>: Upload and download trees", "[executor]") { remote_config->remote_address->host, remote_config->remote_address->port, &*auth_config, + &RetryConfig::Instance(), config}}; }, &*auth_config, @@ -159,6 +164,7 @@ TEST_CASE("Executor<BazelApi>: Retrieve output directories", "[executor]") { remote_config->remote_address->host, remote_config->remote_address->port, &*auth_config, + &RetryConfig::Instance(), config}}; }, &*auth_config, |