summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-07-29 14:55:31 +0200
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-07-30 12:10:06 +0200
commit196554bd9064ed6773740ee0760bb051b89ea857 (patch)
tree44689c8d897aea8bb301aa93cb94529197abd7e3
parent470d8b518fec24aa4f7af50b249acb47c595f780 (diff)
downloadjustbuild-196554bd9064ed6773740ee0760bb051b89ea857.tar.gz
Pass ExecutionContext to GraphTraverser and Executor/Rebuilder
Also update the classes documentation accordingly.
-rw-r--r--src/buildtool/execution_engine/executor/TARGETS5
-rw-r--r--src/buildtool/execution_engine/executor/executor.hpp163
-rw-r--r--src/buildtool/graph_traverser/TARGETS3
-rw-r--r--src/buildtool/graph_traverser/graph_traverser.hpp80
-rw-r--r--src/buildtool/main/TARGETS1
-rw-r--r--src/buildtool/main/main.cpp12
-rw-r--r--src/buildtool/serve_api/serve_service/TARGETS1
-rw-r--r--src/buildtool/serve_api/serve_service/target.cpp12
-rw-r--r--test/buildtool/execution_engine/executor/TARGETS2
-rw-r--r--test/buildtool/execution_engine/executor/executor.test.cpp109
-rw-r--r--test/buildtool/execution_engine/executor/executor_api.test.hpp96
-rw-r--r--test/buildtool/graph_traverser/TARGETS1
-rw-r--r--test/buildtool/graph_traverser/graph_traverser.test.hpp199
13 files changed, 330 insertions, 354 deletions
diff --git a/src/buildtool/execution_engine/executor/TARGETS b/src/buildtool/execution_engine/executor/TARGETS
index 3af6b46b..bac83670 100644
--- a/src/buildtool/execution_engine/executor/TARGETS
+++ b/src/buildtool/execution_engine/executor/TARGETS
@@ -3,14 +3,15 @@
, "name": ["executor"]
, "hdrs": ["executor.hpp"]
, "deps":
- [ ["src/buildtool/logging", "log_level"]
+ [ "context"
+ , ["src/buildtool/logging", "log_level"]
, ["src/buildtool/logging", "logging"]
, ["src/buildtool/common", "common"]
- , ["src/buildtool/common", "config"]
, ["src/buildtool/common", "tree"]
, ["src/buildtool/compatibility", "compatibility"]
, ["src/buildtool/file_system", "file_system_manager"]
, ["src/buildtool/execution_engine/dag", "dag"]
+ , ["src/buildtool/execution_api/common", "api_bundle"]
, ["src/buildtool/execution_api/common", "common"]
, ["src/buildtool/execution_api/common", "common_api"]
, ["src/buildtool/execution_api/remote", "config"]
diff --git a/src/buildtool/execution_engine/executor/executor.hpp b/src/buildtool/execution_engine/executor/executor.hpp
index 9b3a5f86..6541fe24 100644
--- a/src/buildtool/execution_engine/executor/executor.hpp
+++ b/src/buildtool/execution_engine/executor/executor.hpp
@@ -29,12 +29,10 @@
#include "gsl/gsl"
#include "src/buildtool/common/artifact_digest.hpp"
-#include "src/buildtool/common/repository_config.hpp"
#include "src/buildtool/common/statistics.hpp"
#include "src/buildtool/common/tree.hpp"
#include "src/buildtool/compatibility/compatibility.hpp"
#include "src/buildtool/crypto/hash_function.hpp"
-#include "src/buildtool/execution_api/common/api_bundle.hpp"
#include "src/buildtool/execution_api/common/artifact_blob_container.hpp"
#include "src/buildtool/execution_api/common/common_api.hpp"
#include "src/buildtool/execution_api/common/execution_api.hpp"
@@ -42,6 +40,7 @@
#include "src/buildtool/execution_api/remote/config.hpp"
#include "src/buildtool/execution_api/remote/context.hpp"
#include "src/buildtool/execution_engine/dag/dag.hpp"
+#include "src/buildtool/execution_engine/executor/context.hpp"
#include "src/buildtool/file_system/file_system_manager.hpp"
#include "src/buildtool/logging/log_level.hpp"
#include "src/buildtool/logging/logger.hpp"
@@ -173,8 +172,7 @@ class ExecutorImpl {
Logger const& logger,
gsl::not_null<DependencyGraph::ArtifactNode const*> const& artifact,
gsl::not_null<const RepositoryConfig*> const& repo_config,
- ApiBundle const& apis,
- HashFunction hash_function) noexcept -> bool {
+ ApiBundle const& apis) noexcept -> bool {
auto const object_info_opt = artifact->Content().Info();
auto const file_path_opt = artifact->Content().FilePath();
// If there is no object info and no file path, the artifact can not be
@@ -233,8 +231,11 @@ class ExecutorImpl {
return oss.str();
});
auto repo = artifact->Content().Repository();
- auto new_info = UploadFile(
- *apis.remote, hash_function, repo, repo_config, *file_path_opt);
+ auto new_info = UploadFile(*apis.remote,
+ apis.hash_function,
+ repo,
+ repo_config,
+ *file_path_opt);
if (not new_info) {
Logger::Log(LogLevel::Error,
"artifact in {} could not be uploaded to CAS.",
@@ -710,23 +711,17 @@ class Executor {
using CF = IExecutionAction::CacheFlag;
public:
+ /// \brief Create rebuilder for action comparision of two endpoints.
+ /// \param context Execution context. References all the required
+ /// information needed to execute actions on a specified remote endpoint.
+ /// \param logger Overwrite the default logger. Useful for orchestrated
+ /// builds, i.e., triggered by just serve.
+ /// \param timeout Timeout for action execution.
explicit Executor(
- gsl::not_null<const RepositoryConfig*> const& repo_config,
- gsl::not_null<ApiBundle const*> const& apis,
- gsl::not_null<RemoteContext const*> const& remote_context,
- HashFunction hash_function,
- gsl::not_null<Statistics*> const& stats,
- gsl::not_null<Progress*> const& progress,
+ gsl::not_null<ExecutionContext const*> const& context,
Logger const* logger = nullptr, // log in caller logger, if given
std::chrono::milliseconds timeout = IExecutionAction::kDefaultTimeout)
- : repo_config_{repo_config},
- apis_{*apis},
- remote_context_{*remote_context},
- hash_function_{hash_function},
- stats_{stats},
- progress_{progress},
- logger_{logger},
- timeout_{timeout} {}
+ : context_{*context}, logger_{logger}, timeout_{timeout} {}
/// \brief Run an action in a blocking manner
/// This method must be thread-safe as it could be called in parallel
@@ -741,20 +736,22 @@ class Executor {
auto const response = Impl::ExecuteAction(
*logger_,
action,
- *apis_.remote,
+ *context_.apis->remote,
Impl::MergeProperties(
- remote_context_.exec_config->platform_properties,
+ context_.remote_context->exec_config->platform_properties,
action->ExecutionProperties()),
- &remote_context_,
- hash_function_,
+ context_.remote_context,
+ context_.apis->hash_function,
Impl::ScaleTime(timeout_, action->TimeoutScale()),
action->NoCache() ? CF::DoNotCacheOutput : CF::CacheOutput,
- stats_,
- progress_);
+ context_.statistics,
+ context_.progress);
// check response and save digests of results
- return not response or
- Impl::ParseResponse(
- *logger_, *response, action, stats_, progress_);
+ return not response or Impl::ParseResponse(*logger_,
+ *response,
+ action,
+ context_.statistics,
+ context_.progress);
}
Logger logger("action:" + action->Content().Id());
@@ -762,21 +759,23 @@ class Executor {
auto const response = Impl::ExecuteAction(
logger,
action,
- *apis_.remote,
+ *context_.apis->remote,
Impl::MergeProperties(
- remote_context_.exec_config->platform_properties,
+ context_.remote_context->exec_config->platform_properties,
action->ExecutionProperties()),
- &remote_context_,
- hash_function_,
+ context_.remote_context,
+ context_.apis->hash_function,
Impl::ScaleTime(timeout_, action->TimeoutScale()),
action->NoCache() ? CF::DoNotCacheOutput : CF::CacheOutput,
- stats_,
- progress_);
+ context_.statistics,
+ context_.progress);
// check response and save digests of results
- return not response or
- Impl::ParseResponse(
- logger, *response, action, stats_, progress_);
+ return not response or Impl::ParseResponse(logger,
+ *response,
+ action,
+ context_.statistics,
+ context_.progress);
}
/// \brief Check artifact is available to the CAS or upload it.
@@ -790,21 +789,16 @@ class Executor {
// non-copyable and non-movable object, we need some code duplication
if (logger_ != nullptr) {
return Impl::VerifyOrUploadArtifact(
- *logger_, artifact, repo_config_, apis_, hash_function_);
+ *logger_, artifact, context_.repo_config, *context_.apis);
}
Logger logger("artifact:" + ToHexString(artifact->Content().Id()));
return Impl::VerifyOrUploadArtifact(
- logger, artifact, repo_config_, apis_, hash_function_);
+ logger, artifact, context_.repo_config, *context_.apis);
}
private:
- gsl::not_null<const RepositoryConfig*> repo_config_;
- ApiBundle const& apis_;
- RemoteContext const& remote_context_;
- HashFunction const hash_function_;
- gsl::not_null<Statistics*> stats_;
- gsl::not_null<Progress*> progress_;
+ ExecutionContext const& context_;
Logger const* logger_;
std::chrono::milliseconds timeout_;
};
@@ -816,28 +810,19 @@ class Rebuilder {
public:
/// \brief Create rebuilder for action comparision of two endpoints.
- /// \param api Rebuild endpoint, executes without action cache.
- /// \param api_cached Reference endpoint, serves everything from cache.
- /// \param properties Platform properties for execution.
- /// \param timeout Timeout for action execution.
- Rebuilder(
- gsl::not_null<const RepositoryConfig*> const& repo_config,
- gsl::not_null<ApiBundle const*> const& apis,
- gsl::not_null<RemoteContext const*> const& remote_context,
- HashFunction hash_function,
- gsl::not_null<Statistics*> const& stats,
- gsl::not_null<Progress*> const& progress,
+ /// \param context Execution context. References all the required
+ /// information needed to perform a rebuild, during which the results of
+ /// executing actions on the regular remote endpoint and the cache endpoint
+ /// are compared.
+ /// \param timeout Timeout for action execution.
+ explicit Rebuilder(
+ gsl::not_null<ExecutionContext const*> const& context,
std::chrono::milliseconds timeout = IExecutionAction::kDefaultTimeout)
- : repo_config_{repo_config},
- apis_{*apis},
- api_cached_{
- apis->MakeRemote(remote_context->exec_config->cache_address,
- remote_context->auth,
- remote_context->retry_config)},
- remote_context_{*remote_context},
- hash_function_{hash_function},
- stats_{stats},
- progress_{progress},
+ : context_{*context},
+ api_cached_{context_.apis->MakeRemote(
+ context_.remote_context->exec_config->cache_address,
+ context_.remote_context->auth,
+ context_.remote_context->retry_config)},
timeout_{timeout} {}
[[nodiscard]] auto Process(
@@ -848,16 +833,16 @@ class Rebuilder {
auto response = Impl::ExecuteAction(
logger,
action,
- *apis_.remote,
+ *context_.apis->remote,
Impl::MergeProperties(
- remote_context_.exec_config->platform_properties,
+ context_.remote_context->exec_config->platform_properties,
action->ExecutionProperties()),
- &remote_context_,
- hash_function_,
+ context_.remote_context,
+ context_.apis->hash_function,
Impl::ScaleTime(timeout_, action->TimeoutScale()),
CF::PretendCached,
- stats_,
- progress_);
+ context_.statistics,
+ context_.progress);
if (not response) {
return true; // action without response (e.g., tree action)
@@ -869,14 +854,14 @@ class Rebuilder {
action,
*api_cached_,
Impl::MergeProperties(
- remote_context_.exec_config->platform_properties,
+ context_.remote_context->exec_config->platform_properties,
action->ExecutionProperties()),
- &remote_context_,
- hash_function_,
+ context_.remote_context,
+ context_.apis->hash_function,
Impl::ScaleTime(timeout_, action->TimeoutScale()),
CF::FromCacheOnly,
- stats_,
- progress_);
+ context_.statistics,
+ context_.progress);
if (not response_cached) {
logger_cached.Emit(LogLevel::Error,
@@ -888,8 +873,8 @@ class Rebuilder {
return Impl::ParseResponse(logger,
*response,
action,
- stats_,
- progress_,
+ context_.statistics,
+ context_.progress,
/*count_as_executed=*/true);
}
@@ -898,7 +883,7 @@ class Rebuilder {
const noexcept -> bool {
Logger logger("artifact:" + ToHexString(artifact->Content().Id()));
return Impl::VerifyOrUploadArtifact(
- logger, artifact, repo_config_, apis_, hash_function_);
+ logger, artifact, context_.repo_config, *context_.apis);
}
[[nodiscard]] auto DumpFlakyActions() const noexcept -> nlohmann::json {
@@ -914,13 +899,8 @@ class Rebuilder {
}
private:
- gsl::not_null<const RepositoryConfig*> repo_config_;
- ApiBundle const& apis_;
+ ExecutionContext const& context_;
gsl::not_null<IExecutionApi::Ptr> const api_cached_;
- RemoteContext const& remote_context_;
- HashFunction const hash_function_;
- gsl::not_null<Statistics*> stats_;
- gsl::not_null<Progress*> progress_;
std::chrono::milliseconds timeout_;
mutable std::mutex m_;
mutable std::vector<std::string> cache_misses_{};
@@ -934,9 +914,10 @@ class Rebuilder {
void DetectFlakyAction(IExecutionResponse::Ptr const& response,
IExecutionResponse::Ptr const& response_cached,
Action const& action) const noexcept {
+ auto& stats = *context_.statistics;
if (response and response_cached and
response_cached->ActionDigest() == response->ActionDigest()) {
- stats_->IncrementRebuiltActionComparedCounter();
+ stats.IncrementRebuiltActionComparedCounter();
auto artifacts = response->Artifacts();
auto artifacts_cached = response_cached->Artifacts();
std::ostringstream msg{};
@@ -947,10 +928,10 @@ class Rebuilder {
}
}
if (msg.tellp() > 0) {
- stats_->IncrementActionsFlakyCounter();
+ stats.IncrementActionsFlakyCounter();
bool tainted = action.MayFail() or action.NoCache();
if (tainted) {
- stats_->IncrementActionsFlakyTaintedCounter();
+ stats.IncrementActionsFlakyTaintedCounter();
}
Logger::Log(tainted ? LogLevel::Debug : LogLevel::Warning,
"{}",
@@ -958,7 +939,7 @@ class Rebuilder {
}
}
else {
- stats_->IncrementRebuiltActionMissingCounter();
+ stats.IncrementRebuiltActionMissingCounter();
std::unique_lock lock{m_};
cache_misses_.emplace_back(action.Id());
}
diff --git a/src/buildtool/graph_traverser/TARGETS b/src/buildtool/graph_traverser/TARGETS
index b216943c..3c64489b 100644
--- a/src/buildtool/graph_traverser/TARGETS
+++ b/src/buildtool/graph_traverser/TARGETS
@@ -5,14 +5,13 @@
, "deps":
[ ["src/buildtool/common", "cli"]
, ["src/buildtool/common", "common"]
- , ["src/buildtool/common", "config"]
, ["src/buildtool/common", "tree"]
, ["src/buildtool/execution_engine/dag", "dag"]
+ , ["src/buildtool/execution_engine/executor", "context"]
, ["src/buildtool/execution_engine/executor", "executor"]
, ["src/buildtool/execution_engine/traverser", "traverser"]
, ["src/buildtool/execution_api/common", "common"]
, ["src/buildtool/execution_api/common", "common_api"]
- , ["src/buildtool/execution_api/common", "api_bundle"]
, ["src/buildtool/execution_api/remote", "config"]
, ["src/buildtool/execution_api/utils", "subobject"]
, ["src/buildtool/file_system", "file_system_manager"]
diff --git a/src/buildtool/graph_traverser/graph_traverser.hpp b/src/buildtool/graph_traverser/graph_traverser.hpp
index 50eb95c5..24d3997e 100644
--- a/src/buildtool/graph_traverser/graph_traverser.hpp
+++ b/src/buildtool/graph_traverser/graph_traverser.hpp
@@ -33,16 +33,14 @@
#include "gsl/gsl"
#include "src/buildtool/common/artifact_digest.hpp"
#include "src/buildtool/common/cli.hpp"
-#include "src/buildtool/common/repository_config.hpp"
-#include "src/buildtool/common/statistics.hpp"
#include "src/buildtool/common/tree.hpp"
-#include "src/buildtool/execution_api/common/api_bundle.hpp"
#include "src/buildtool/execution_api/common/artifact_blob_container.hpp"
#include "src/buildtool/execution_api/common/common_api.hpp"
#include "src/buildtool/execution_api/common/execution_api.hpp"
#include "src/buildtool/execution_api/remote/config.hpp"
#include "src/buildtool/execution_api/utils/subobject.hpp"
#include "src/buildtool/execution_engine/dag/dag.hpp"
+#include "src/buildtool/execution_engine/executor/context.hpp"
#include "src/buildtool/execution_engine/executor/executor.hpp"
#include "src/buildtool/execution_engine/traverser/traverser.hpp"
#include "src/buildtool/file_system/file_system_manager.hpp"
@@ -74,19 +72,11 @@ class GraphTraverser {
explicit GraphTraverser(
CommandLineArguments clargs,
- gsl::not_null<const RepositoryConfig*> const& repo_config,
- gsl::not_null<RemoteContext const*> const& remote_context,
- gsl::not_null<Statistics*> const& stats,
- gsl::not_null<Progress*> const& progress,
- gsl::not_null<ApiBundle const*> const& apis,
+ gsl::not_null<const ExecutionContext*> const& context,
progress_reporter_t reporter,
Logger const* logger = nullptr)
: clargs_{std::move(clargs)},
- repo_config_{repo_config},
- remote_context_{*remote_context},
- stats_{stats},
- progress_{progress},
- apis_{*apis},
+ context_{*context},
reporter_{std::move(reporter)},
logger_{logger} {}
@@ -152,8 +142,8 @@ class GraphTraverser {
}
if (clargs_.stage->remember) {
- if (not apis_.remote->ParallelRetrieveToCas(
- *object_infos, *apis_.local, clargs_.jobs, true)) {
+ if (not context_.apis->remote->ParallelRetrieveToCas(
+ *object_infos, *context_.apis->local, clargs_.jobs, true)) {
Logger::Log(logger_,
LogLevel::Warning,
"Failed to copy objects to CAS");
@@ -222,11 +212,7 @@ class GraphTraverser {
private:
CommandLineArguments const clargs_;
- gsl::not_null<const RepositoryConfig*> repo_config_;
- RemoteContext const& remote_context_;
- gsl::not_null<Statistics*> stats_;
- gsl::not_null<Progress*> progress_;
- ApiBundle const& apis_;
+ ExecutionContext const& context_;
progress_reporter_t reporter_;
Logger const* logger_{nullptr};
@@ -289,7 +275,7 @@ class GraphTraverser {
ArtifactBlobContainer container;
for (auto const& blob : blobs) {
auto digest = ArtifactDigest::Create<ObjectType::File>(
- apis_.hash_function, blob);
+ context_.apis->hash_function, blob);
Logger::Log(logger_, LogLevel::Trace, [&]() {
return fmt::format(
"Uploaded blob {}, its digest has id {} and size {}.",
@@ -303,7 +289,8 @@ class GraphTraverser {
&container,
ArtifactBlob{std::move(digest), blob, /*is_exec=*/false},
/*exception_is_fatal=*/true,
- [&api = apis_.remote](ArtifactBlobContainer&& blobs) {
+ [&api =
+ context_.apis->remote](ArtifactBlobContainer&& blobs) {
return api->Upload(std::move(blobs));
},
logger_)) {
@@ -311,7 +298,7 @@ class GraphTraverser {
}
}
// Upload remaining blobs.
- return apis_.remote->Upload(std::move(container));
+ return context_.apis->remote->Upload(std::move(container));
}
/// \brief Adds the artifacts to be retrieved to the graph
@@ -354,14 +341,7 @@ class GraphTraverser {
[[nodiscard]] auto Traverse(
DependencyGraph const& g,
std::vector<ArtifactIdentifier> const& artifact_ids) const -> bool {
- Executor executor{repo_config_,
- &apis_,
- &remote_context_,
- apis_.hash_function,
- stats_,
- progress_,
- logger_,
- clargs_.build.timeout};
+ Executor executor{&context_, logger_, clargs_.build.timeout};
bool traversing{};
std::atomic<bool> done = false;
std::atomic<bool> failed = false;
@@ -382,13 +362,7 @@ class GraphTraverser {
[[nodiscard]] auto TraverseRebuild(
DependencyGraph const& g,
std::vector<ArtifactIdentifier> const& artifact_ids) const -> bool {
- Rebuilder executor{repo_config_,
- &apis_,
- &remote_context_,
- apis_.hash_function,
- stats_,
- progress_,
- clargs_.build.timeout};
+ Rebuilder executor{&context_, clargs_.build.timeout};
bool traversing{false};
std::atomic<bool> done = false;
std::atomic<bool> failed = false;
@@ -436,19 +410,20 @@ class GraphTraverser {
}
void LogStatistics() const noexcept {
+ auto& stats = *context_.statistics;
if (clargs_.rebuild) {
std::stringstream ss{};
- ss << stats_->RebuiltActionComparedCounter()
+ ss << stats.RebuiltActionComparedCounter()
<< " actions compared with cache";
- if (stats_->ActionsFlakyCounter() > 0) {
- ss << ", " << stats_->ActionsFlakyCounter()
+ if (stats.ActionsFlakyCounter() > 0) {
+ ss << ", " << stats.ActionsFlakyCounter()
<< " flaky actions found";
- ss << " (" << stats_->ActionsFlakyTaintedCounter()
+ ss << " (" << stats.ActionsFlakyTaintedCounter()
<< " of which tainted)";
}
- if (stats_->RebuiltActionMissingCounter() > 0) {
+ if (stats.RebuiltActionMissingCounter() > 0) {
ss << ", no cache entry found for "
- << stats_->RebuiltActionMissingCounter() << " actions";
+ << stats.RebuiltActionMissingCounter() << " actions";
}
ss << ".";
Logger::Log(logger_, LogLevel::Info, ss.str());
@@ -457,8 +432,8 @@ class GraphTraverser {
Logger::Log(logger_,
LogLevel::Info,
"Processed {} actions, {} cache hits.",
- stats_->ActionsQueuedCounter(),
- stats_->ActionsCachedCounter());
+ stats.ActionsQueuedCounter(),
+ stats.ActionsCachedCounter());
}
}
@@ -586,8 +561,8 @@ class GraphTraverser {
auto output_paths = PrepareOutputPaths(rel_paths);
if (not output_paths or
- not apis_.remote->RetrieveToPaths(
- object_infos, *output_paths, &*apis_.local)) {
+ not context_.apis->remote->RetrieveToPaths(
+ object_infos, *output_paths, &*context_.apis->local)) {
Logger::Log(
logger_, LogLevel::Error, "Could not retrieve outputs.");
return std::nullopt;
@@ -662,14 +637,14 @@ class GraphTraverser {
std::vector<DependencyGraph::ArtifactNode const*> const& artifacts)
const {
if (clargs_.build.print_to_stdout) {
+ auto const& remote = *context_.apis->remote;
for (std::size_t i = 0; i < paths.size(); i++) {
if (paths[i] == *(clargs_.build.print_to_stdout)) {
auto info = artifacts[i]->Content().Info();
if (info) {
- if (not apis_.remote->RetrieveToFds(
- {*info},
- {dup(fileno(stdout))},
- /*raw_tree=*/false)) {
+ if (not remote.RetrieveToFds({*info},
+ {dup(fileno(stdout))},
+ /*raw_tree=*/false)) {
Logger::Log(logger_,
LogLevel::Error,
"Failed to retrieve {}",
@@ -691,7 +666,6 @@ class GraphTraverser {
auto target_path = ToNormalPath(std::filesystem::path{
*clargs_.build.print_to_stdout})
.relative_path();
- auto const& remote = *apis_.remote;
for (std::size_t i = 0; i < paths.size(); i++) {
auto const& path = paths[i];
auto relpath = target_path.lexically_relative(path);
diff --git a/src/buildtool/main/TARGETS b/src/buildtool/main/TARGETS
index 5e4bf519..b3c89391 100644
--- a/src/buildtool/main/TARGETS
+++ b/src/buildtool/main/TARGETS
@@ -23,6 +23,7 @@
, ["src/utils/cpp", "concepts"]
, ["src/utils/cpp", "json"]
, ["src/buildtool/auth", "auth"]
+ , ["src/buildtool/execution_engine/executor", "context"]
, [ "src/buildtool/execution_api/execution_service"
, "server_implementation"
]
diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp
index e97b5a27..8f66e0d6 100644
--- a/src/buildtool/main/main.cpp
+++ b/src/buildtool/main/main.cpp
@@ -76,6 +76,7 @@
#include "src/buildtool/execution_api/local/context.hpp"
#include "src/buildtool/execution_api/remote/config.hpp"
#include "src/buildtool/execution_api/remote/context.hpp"
+#include "src/buildtool/execution_engine/executor/context.hpp"
#include "src/buildtool/graph_traverser/graph_traverser.hpp"
#include "src/buildtool/main/describe.hpp"
#include "src/buildtool/main/retry.hpp"
@@ -992,16 +993,17 @@ auto main(int argc, char* argv[]) -> int {
auto const main_apis =
ApiBundle::Create(&local_context, &remote_context, &repo_config);
+ ExecutionContext const exec_context{.repo_config = &repo_config,
+ .apis = &main_apis,
+ .remote_context = &remote_context,
+ .statistics = &stats,
+ .progress = &progress};
GraphTraverser const traverser{
{jobs,
std::move(arguments.build),
std::move(stage_args),
std::move(rebuild_args)},
- &repo_config,
- &remote_context,
- &stats,
- &progress,
- &main_apis,
+ &exec_context,
ProgressReporter::Reporter(&stats, &progress)};
if (arguments.cmd == SubCommand::kInstallCas) {
diff --git a/src/buildtool/serve_api/serve_service/TARGETS b/src/buildtool/serve_api/serve_service/TARGETS
index 71f4c574..1a080b66 100644
--- a/src/buildtool/serve_api/serve_service/TARGETS
+++ b/src/buildtool/serve_api/serve_service/TARGETS
@@ -108,6 +108,7 @@
, ["src/buildtool/build_engine/target_map", "result_map"]
, ["src/buildtool/common/remote", "remote_common"]
, ["src/buildtool/common/remote", "retry_config"]
+ , ["src/buildtool/execution_engine/executor", "context"]
, ["src/buildtool/file_system", "file_system_manager"]
, ["src/buildtool/graph_traverser", "graph_traverser"]
, ["src/buildtool/logging", "log_level"]
diff --git a/src/buildtool/serve_api/serve_service/target.cpp b/src/buildtool/serve_api/serve_service/target.cpp
index 9ad1520b..a0289cc0 100644
--- a/src/buildtool/serve_api/serve_service/target.cpp
+++ b/src/buildtool/serve_api/serve_service/target.cpp
@@ -28,6 +28,7 @@
#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_engine/executor/context.hpp"
#include "src/buildtool/file_system/file_system_manager.hpp"
#include "src/buildtool/file_system/object_type.hpp"
#include "src/buildtool/graph_traverser/graph_traverser.hpp"
@@ -503,14 +504,15 @@ auto TargetService::ServeTarget(
// dispatch endpoint for traversing
auto const local_apis = ApiBundle::Create(
&local_context_, &dispatch_context, &repository_config);
+ ExecutionContext const exec_context{.repo_config = &repository_config,
+ .apis = &local_apis,
+ .remote_context = &dispatch_context,
+ .statistics = &stats,
+ .progress = &progress};
GraphTraverser const traverser{
std::move(traverser_args),
- &repository_config,
- &dispatch_context,
- &stats,
- &progress,
- &local_apis,
+ &exec_context,
ProgressReporter::Reporter(&stats, &progress, &logger),
&logger};
diff --git a/test/buildtool/execution_engine/executor/TARGETS b/test/buildtool/execution_engine/executor/TARGETS
index ab257156..39a2c3de 100644
--- a/test/buildtool/execution_engine/executor/TARGETS
+++ b/test/buildtool/execution_engine/executor/TARGETS
@@ -10,6 +10,7 @@
, ["@", "src", "src/buildtool/execution_api/remote", "config"]
, ["@", "src", "src/buildtool/execution_api/remote", "context"]
, ["@", "src", "src/buildtool/execution_engine/dag", "dag"]
+ , ["@", "src", "src/buildtool/execution_engine/executor", "context"]
, ["@", "src", "src/buildtool/execution_engine/executor", "executor"]
, ["@", "src", "src/buildtool/file_system", "file_system_manager"]
, ["@", "src", "src/buildtool/progress_reporting", "progress"]
@@ -36,6 +37,7 @@
, ["@", "src", "src/buildtool/execution_api/remote", "config"]
, ["@", "src", "src/buildtool/execution_api/remote", "context"]
, ["@", "src", "src/buildtool/execution_engine/dag", "dag"]
+ , ["@", "src", "src/buildtool/execution_engine/executor", "context"]
, ["@", "src", "src/buildtool/execution_engine/executor", "executor"]
, ["@", "src", "src/buildtool/progress_reporting", "progress"]
, ["@", "src", "src/buildtool/crypto", "hash_function"]
diff --git a/test/buildtool/execution_engine/executor/executor.test.cpp b/test/buildtool/execution_engine/executor/executor.test.cpp
index 15752c94..961d5b0f 100644
--- a/test/buildtool/execution_engine/executor/executor.test.cpp
+++ b/test/buildtool/execution_engine/executor/executor.test.cpp
@@ -32,6 +32,7 @@
#include "src/buildtool/execution_api/common/execution_api.hpp"
#include "src/buildtool/execution_api/remote/config.hpp"
#include "src/buildtool/execution_api/remote/context.hpp"
+#include "src/buildtool/execution_engine/executor/context.hpp"
#include "src/buildtool/execution_engine/executor/executor.hpp"
#include "src/buildtool/file_system/file_system_manager.hpp"
#include "src/buildtool/progress_reporting/progress.hpp"
@@ -298,12 +299,12 @@ TEST_CASE("Executor: Process artifact", "[executor]") {
.retry_config = &retry_config,
.exec_config = &remote_config};
auto const apis = CreateTestApiBundle(hash_function, api);
- Executor runner{&repo_config,
- &apis,
- &remote_context,
- hash_function,
- &stats,
- &progress};
+ ExecutionContext const exec_context{.repo_config = &repo_config,
+ .apis = &apis,
+ .remote_context = &remote_context,
+ .statistics = &stats,
+ .progress = &progress};
+ Executor runner{&exec_context};
CHECK(runner.Process(g.ArtifactNodeWithId(local_cpp_id)));
CHECK(runner.Process(g.ArtifactNodeWithId(known_cpp_id)));
@@ -322,12 +323,12 @@ TEST_CASE("Executor: Process artifact", "[executor]") {
.retry_config = &retry_config,
.exec_config = &remote_config};
auto const apis = CreateTestApiBundle(hash_function, api);
- Executor runner{&repo_config,
- &apis,
- &remote_context,
- hash_function,
- &stats,
- &progress};
+ ExecutionContext const exec_context{.repo_config = &repo_config,
+ .apis = &apis,
+ .remote_context = &remote_context,
+ .statistics = &stats,
+ .progress = &progress};
+ Executor runner{&exec_context};
CHECK(not runner.Process(g.ArtifactNodeWithId(local_cpp_id)));
CHECK(runner.Process(g.ArtifactNodeWithId(known_cpp_id)));
@@ -346,12 +347,12 @@ TEST_CASE("Executor: Process artifact", "[executor]") {
.retry_config = &retry_config,
.exec_config = &remote_config};
auto const apis = CreateTestApiBundle(hash_function, api);
- Executor runner{&repo_config,
- &apis,
- &remote_context,
- hash_function,
- &stats,
- &progress};
+ ExecutionContext const exec_context{.repo_config = &repo_config,
+ .apis = &apis,
+ .remote_context = &remote_context,
+ .statistics = &stats,
+ .progress = &progress};
+ Executor runner{&exec_context};
CHECK(runner.Process(g.ArtifactNodeWithId(local_cpp_id)));
CHECK(not runner.Process(g.ArtifactNodeWithId(known_cpp_id)));
@@ -395,12 +396,12 @@ TEST_CASE("Executor: Process action", "[executor]") {
.retry_config = &retry_config,
.exec_config = &remote_config};
auto const apis = CreateTestApiBundle(hash_function, api);
- Executor runner{&repo_config,
- &apis,
- &remote_context,
- hash_function,
- &stats,
- &progress};
+ ExecutionContext const exec_context{.repo_config = &repo_config,
+ .apis = &apis,
+ .remote_context = &remote_context,
+ .statistics = &stats,
+ .progress = &progress};
+ Executor runner{&exec_context};
CHECK(runner.Process(g.ArtifactNodeWithId(local_cpp_id)));
CHECK(runner.Process(g.ArtifactNodeWithId(known_cpp_id)));
@@ -422,12 +423,12 @@ TEST_CASE("Executor: Process action", "[executor]") {
.retry_config = &retry_config,
.exec_config = &remote_config};
auto const apis = CreateTestApiBundle(hash_function, api);
- Executor runner{&repo_config,
- &apis,
- &remote_context,
- hash_function,
- &stats,
- &progress};
+ ExecutionContext const exec_context{.repo_config = &repo_config,
+ .apis = &apis,
+ .remote_context = &remote_context,
+ .statistics = &stats,
+ .progress = &progress};
+ Executor runner{&exec_context};
CHECK(runner.Process(g.ArtifactNodeWithId(local_cpp_id)));
CHECK(runner.Process(g.ArtifactNodeWithId(known_cpp_id)));
@@ -449,12 +450,12 @@ TEST_CASE("Executor: Process action", "[executor]") {
.retry_config = &retry_config,
.exec_config = &remote_config};
auto const apis = CreateTestApiBundle(hash_function, api);
- Executor runner{&repo_config,
- &apis,
- &remote_context,
- hash_function,
- &stats,
- &progress};
+ ExecutionContext const exec_context{.repo_config = &repo_config,
+ .apis = &apis,
+ .remote_context = &remote_context,
+ .statistics = &stats,
+ .progress = &progress};
+ Executor runner{&exec_context};
CHECK(runner.Process(g.ArtifactNodeWithId(local_cpp_id)));
CHECK(runner.Process(g.ArtifactNodeWithId(known_cpp_id)));
@@ -479,12 +480,12 @@ TEST_CASE("Executor: Process action", "[executor]") {
.retry_config = &retry_config,
.exec_config = &remote_config};
auto const apis = CreateTestApiBundle(hash_function, api);
- Executor runner{&repo_config,
- &apis,
- &remote_context,
- hash_function,
- &stats,
- &progress};
+ ExecutionContext const exec_context{.repo_config = &repo_config,
+ .apis = &apis,
+ .remote_context = &remote_context,
+ .statistics = &stats,
+ .progress = &progress};
+ Executor runner{&exec_context};
CHECK(runner.Process(g.ArtifactNodeWithId(local_cpp_id)));
CHECK(runner.Process(g.ArtifactNodeWithId(known_cpp_id)));
@@ -506,12 +507,12 @@ TEST_CASE("Executor: Process action", "[executor]") {
.retry_config = &retry_config,
.exec_config = &remote_config};
auto const apis = CreateTestApiBundle(hash_function, api);
- Executor runner{&repo_config,
- &apis,
- &remote_context,
- hash_function,
- &stats,
- &progress};
+ ExecutionContext const exec_context{.repo_config = &repo_config,
+ .apis = &apis,
+ .remote_context = &remote_context,
+ .statistics = &stats,
+ .progress = &progress};
+ Executor runner{&exec_context};
CHECK(runner.Process(g.ArtifactNodeWithId(local_cpp_id)));
CHECK(runner.Process(g.ArtifactNodeWithId(known_cpp_id)));
@@ -536,12 +537,12 @@ TEST_CASE("Executor: Process action", "[executor]") {
.retry_config = &retry_config,
.exec_config = &remote_config};
auto const apis = CreateTestApiBundle(hash_function, api);
- Executor runner{&repo_config,
- &apis,
- &remote_context,
- hash_function,
- &stats,
- &progress};
+ ExecutionContext const exec_context{.repo_config = &repo_config,
+ .apis = &apis,
+ .remote_context = &remote_context,
+ .statistics = &stats,
+ .progress = &progress};
+ Executor runner{&exec_context};
CHECK(runner.Process(g.ArtifactNodeWithId(local_cpp_id)));
CHECK(runner.Process(g.ArtifactNodeWithId(known_cpp_id)));
diff --git a/test/buildtool/execution_engine/executor/executor_api.test.hpp b/test/buildtool/execution_engine/executor/executor_api.test.hpp
index bef97e85..896279ef 100644
--- a/test/buildtool/execution_engine/executor/executor_api.test.hpp
+++ b/test/buildtool/execution_engine/executor/executor_api.test.hpp
@@ -35,6 +35,7 @@
#include "src/buildtool/execution_api/remote/config.hpp"
#include "src/buildtool/execution_api/remote/context.hpp"
#include "src/buildtool/execution_engine/dag/dag.hpp"
+#include "src/buildtool/execution_engine/executor/context.hpp"
#include "src/buildtool/execution_engine/executor/executor.hpp"
#include "src/buildtool/file_system/file_system_manager.hpp"
#include "src/buildtool/progress_reporting/progress.hpp"
@@ -149,8 +150,13 @@ static inline void RunHelloWorldCompilation(
auto api = factory();
auto const apis = CreateTestApiBundle(hash_function, api);
- Executor runner{
- repo_config, &apis, &remote_context, hash_function, stats, progress};
+
+ ExecutionContext const exec_context{.repo_config = repo_config,
+ .apis = &apis,
+ .remote_context = &remote_context,
+ .statistics = stats,
+ .progress = progress};
+ Executor runner{&exec_context};
// upload local artifacts
auto const* main_cpp_node = g.ArtifactNodeWithId(main_cpp_id);
@@ -279,8 +285,13 @@ static inline void RunGreeterCompilation(
auto api = factory();
auto const apis = CreateTestApiBundle(hash_function, api);
- Executor runner{
- repo_config, &apis, &remote_context, hash_function, stats, progress};
+
+ ExecutionContext const exec_context{.repo_config = repo_config,
+ .apis = &apis,
+ .remote_context = &remote_context,
+ .statistics = stats,
+ .progress = progress};
+ Executor runner{&exec_context};
// upload local artifacts
for (auto const& id : {greet_hpp_id, greet_cpp_id, main_cpp_id}) {
@@ -449,8 +460,14 @@ static inline void TestUploadAndDownloadTrees(
.exec_config = &*remote_config};
auto const apis = CreateTestApiBundle(hash_function, api);
- Executor runner{
- repo_config, &apis, &remote_context, hash_function, stats, progress};
+
+ ExecutionContext const exec_context{.repo_config = repo_config,
+ .apis = &apis,
+ .remote_context = &remote_context,
+ .statistics = stats,
+ .progress = progress};
+ Executor runner{&exec_context};
+
REQUIRE(runner.Process(g.ArtifactNodeWithId(foo_id)));
REQUIRE(runner.Process(g.ArtifactNodeWithId(bar_id)));
@@ -620,12 +637,13 @@ static inline void TestRetrieveOutputDirectories(
// run action
auto api = factory();
auto const apis = CreateTestApiBundle(hash_function, api);
- Executor runner{repo_config,
- &apis,
- &remote_context,
- hash_function,
- stats,
- progress};
+
+ ExecutionContext const exec_context{.repo_config = repo_config,
+ .apis = &apis,
+ .remote_context = &remote_context,
+ .statistics = stats,
+ .progress = progress};
+ Executor runner{&exec_context};
REQUIRE(runner.Process(action));
// read output
@@ -673,12 +691,13 @@ static inline void TestRetrieveOutputDirectories(
// run action
auto api = factory();
auto const apis = CreateTestApiBundle(hash_function, api);
- Executor runner{repo_config,
- &apis,
- &remote_context,
- hash_function,
- stats,
- progress};
+
+ ExecutionContext const exec_context{.repo_config = repo_config,
+ .apis = &apis,
+ .remote_context = &remote_context,
+ .statistics = stats,
+ .progress = progress};
+ Executor runner{&exec_context};
REQUIRE(runner.Process(action));
// read output
@@ -743,12 +762,13 @@ static inline void TestRetrieveOutputDirectories(
// run action
auto api = factory();
auto const apis = CreateTestApiBundle(hash_function, api);
- Executor runner{repo_config,
- &apis,
- &remote_context,
- hash_function,
- stats,
- progress};
+
+ ExecutionContext const exec_context{.repo_config = repo_config,
+ .apis = &apis,
+ .remote_context = &remote_context,
+ .statistics = stats,
+ .progress = progress};
+ Executor runner{&exec_context};
REQUIRE(runner.Process(action));
// read output
@@ -815,12 +835,14 @@ static inline void TestRetrieveOutputDirectories(
// run action
auto api = factory();
auto const apis = CreateTestApiBundle(hash_function, api);
- Executor runner{repo_config,
- &apis,
- &remote_context,
- hash_function,
- stats,
- progress};
+
+ ExecutionContext const exec_context{
+ .repo_config = repo_config,
+ .apis = &apis,
+ .remote_context = &remote_context,
+ .statistics = stats,
+ .progress = progress};
+ Executor runner{&exec_context};
CHECK_FALSE(runner.Process(action));
}
@@ -840,12 +862,14 @@ static inline void TestRetrieveOutputDirectories(
// run action
auto api = factory();
auto const apis = CreateTestApiBundle(hash_function, api);
- Executor runner{repo_config,
- &apis,
- &remote_context,
- hash_function,
- stats,
- progress};
+
+ ExecutionContext const exec_context{
+ .repo_config = repo_config,
+ .apis = &apis,
+ .remote_context = &remote_context,
+ .statistics = stats,
+ .progress = progress};
+ Executor runner{&exec_context};
CHECK_FALSE(runner.Process(action));
}
}
diff --git a/test/buildtool/graph_traverser/TARGETS b/test/buildtool/graph_traverser/TARGETS
index 1035fbcd..4079857c 100644
--- a/test/buildtool/graph_traverser/TARGETS
+++ b/test/buildtool/graph_traverser/TARGETS
@@ -12,6 +12,7 @@
, ["@", "src", "src/buildtool/execution_api/local", "context"]
, ["@", "src", "src/buildtool/execution_api/remote", "config"]
, ["@", "src", "src/buildtool/execution_api/remote", "context"]
+ , ["@", "src", "src/buildtool/execution_engine/executor", "context"]
, ["@", "src", "src/buildtool/file_system", "file_system_manager"]
, ["@", "src", "src/buildtool/file_system", "jsonfs"]
, ["@", "src", "src/buildtool/graph_traverser", "graph_traverser"]
diff --git a/test/buildtool/graph_traverser/graph_traverser.test.hpp b/test/buildtool/graph_traverser/graph_traverser.test.hpp
index 6618e5bf..28ec44e0 100644
--- a/test/buildtool/graph_traverser/graph_traverser.test.hpp
+++ b/test/buildtool/graph_traverser/graph_traverser.test.hpp
@@ -36,6 +36,7 @@
#include "src/buildtool/execution_api/local/context.hpp"
#include "src/buildtool/execution_api/remote/config.hpp"
#include "src/buildtool/execution_api/remote/context.hpp"
+#include "src/buildtool/execution_engine/executor/context.hpp"
#include "src/buildtool/file_system/file_system_manager.hpp"
#include "src/buildtool/file_system/jsonfs.hpp"
#include "src/buildtool/graph_traverser/graph_traverser.hpp"
@@ -189,13 +190,14 @@ class TestProject {
auto const apis =
ApiBundle::Create(&local_context, &remote_context, p.GetRepoConfig());
- GraphTraverser const gt{clargs.gtargs,
- p.GetRepoConfig(),
- &remote_context,
- &stats,
- &progress,
- &apis,
- [](auto done, auto cv) {}};
+ ExecutionContext const exec_context{.repo_config = p.GetRepoConfig(),
+ .apis = &apis,
+ .remote_context = &remote_context,
+ .statistics = &stats,
+ .progress = &progress};
+
+ GraphTraverser const gt{
+ clargs.gtargs, &exec_context, [](auto done, auto cv) {}};
auto const result =
gt.BuildAndStage(clargs.graph_description, clargs.artifacts);
@@ -214,13 +216,8 @@ class TestProject {
SECTION("Executable is retrieved as executable") {
auto const clargs_exec = p.CmdLineArgs("_entry_points_get_executable");
- GraphTraverser const gt_get_exec{clargs_exec.gtargs,
- p.GetRepoConfig(),
- &remote_context,
- &stats,
- &progress,
- &apis,
- [](auto done, auto cv) {}};
+ GraphTraverser const gt_get_exec{
+ clargs_exec.gtargs, &exec_context, [](auto done, auto cv) {}};
auto const exec_result = gt_get_exec.BuildAndStage(
clargs_exec.graph_description, clargs_exec.artifacts);
@@ -268,13 +265,14 @@ class TestProject {
auto const apis =
ApiBundle::Create(&local_context, &remote_context, p.GetRepoConfig());
- GraphTraverser const gt{clargs.gtargs,
- p.GetRepoConfig(),
- &remote_context,
- &stats,
- &progress,
- &apis,
- [](auto done, auto cv) {}};
+ ExecutionContext const exec_context{.repo_config = p.GetRepoConfig(),
+ .apis = &apis,
+ .remote_context = &remote_context,
+ .statistics = &stats,
+ .progress = &progress};
+
+ GraphTraverser const gt{
+ clargs.gtargs, &exec_context, [](auto done, auto cv) {}};
auto const result =
gt.BuildAndStage(clargs.graph_description, clargs.artifacts);
@@ -317,13 +315,14 @@ class TestProject {
auto const apis =
ApiBundle::Create(&local_context, &remote_context, p.GetRepoConfig());
- GraphTraverser const gt{clargs.gtargs,
- p.GetRepoConfig(),
- &remote_context,
- &stats,
- &progress,
- &apis,
- [](auto done, auto cv) {}};
+ ExecutionContext const exec_context{.repo_config = p.GetRepoConfig(),
+ .apis = &apis,
+ .remote_context = &remote_context,
+ .statistics = &stats,
+ .progress = &progress};
+
+ GraphTraverser const gt{
+ clargs.gtargs, &exec_context, [](auto done, auto cv) {}};
auto const result =
gt.BuildAndStage(clargs.graph_description, clargs.artifacts);
@@ -332,13 +331,8 @@ class TestProject {
CHECK(FileSystemManager::IsFile(result->output_paths.at(0)));
auto const clargs_full_build = p.CmdLineArgs("_entry_points_full_build");
- GraphTraverser const gt_full_build{clargs_full_build.gtargs,
- p.GetRepoConfig(),
- &remote_context,
- &stats,
- &progress,
- &apis,
- [](auto done, auto cv) {}};
+ GraphTraverser const gt_full_build{
+ clargs_full_build.gtargs, &exec_context, [](auto done, auto cv) {}};
auto const full_build_result = gt_full_build.BuildAndStage(
clargs_full_build.graph_description, clargs_full_build.artifacts);
@@ -382,16 +376,18 @@ class TestProject {
.retry_config = &retry_config,
.exec_config = remote_config};
- auto const apis = ApiBundle::Create(
+ auto const full_apis = ApiBundle::Create(
&local_context, &remote_context, full_hello_world.GetRepoConfig());
- GraphTraverser const gt_upload{clargs_update_cpp.gtargs,
- full_hello_world.GetRepoConfig(),
- &remote_context,
- &stats,
- &progress,
- &apis,
- [](auto done, auto cv) {}};
+ ExecutionContext const full_context{
+ .repo_config = full_hello_world.GetRepoConfig(),
+ .apis = &full_apis,
+ .remote_context = &remote_context,
+ .statistics = &stats,
+ .progress = &progress};
+
+ GraphTraverser const gt_upload{
+ clargs_update_cpp.gtargs, &full_context, [](auto done, auto cv) {}};
auto const cpp_result = gt_upload.BuildAndStage(
clargs_update_cpp.graph_description, clargs_update_cpp.artifacts);
@@ -407,13 +403,18 @@ class TestProject {
TestProject hello_world_known_cpp("hello_world_known_source");
auto const clargs = hello_world_known_cpp.CmdLineArgs();
- GraphTraverser const gt{clargs.gtargs,
- full_hello_world.GetRepoConfig(),
- &remote_context,
- &stats,
- &progress,
- &apis,
- [](auto done, auto cv) {}};
+
+ auto const apis_known = ApiBundle::Create(
+ &local_context, &remote_context, hello_world_known_cpp.GetRepoConfig());
+
+ ExecutionContext const context_known{
+ .repo_config = hello_world_known_cpp.GetRepoConfig(),
+ .apis = &apis_known,
+ .remote_context = &remote_context,
+ .statistics = &stats,
+ .progress = &progress};
+ GraphTraverser const gt{
+ clargs.gtargs, &context_known, [](auto done, auto cv) {}};
auto const result =
gt.BuildAndStage(clargs.graph_description, clargs.artifacts);
@@ -459,13 +460,13 @@ static void TestBlobsUploadedAndUsed(
auto const apis =
ApiBundle::Create(&local_context, &remote_context, p.GetRepoConfig());
- GraphTraverser gt{clargs.gtargs,
- p.GetRepoConfig(),
- &remote_context,
- &stats,
- &progress,
- &apis,
- [](auto done, auto cv) {}};
+ ExecutionContext const exec_context{.repo_config = p.GetRepoConfig(),
+ .apis = &apis,
+ .remote_context = &remote_context,
+ .statistics = &stats,
+ .progress = &progress};
+
+ GraphTraverser gt{clargs.gtargs, &exec_context, [](auto done, auto cv) {}};
auto const result =
gt.BuildAndStage(clargs.graph_description, clargs.artifacts);
@@ -516,13 +517,13 @@ static void TestEnvironmentVariablesSetAndUsed(
auto const apis =
ApiBundle::Create(&local_context, &remote_context, p.GetRepoConfig());
- GraphTraverser gt{clargs.gtargs,
- p.GetRepoConfig(),
- &remote_context,
- &stats,
- &progress,
- &apis,
- [](auto done, auto cv) {}};
+ ExecutionContext const exec_context{.repo_config = p.GetRepoConfig(),
+ .apis = &apis,
+ .remote_context = &remote_context,
+ .statistics = &stats,
+ .progress = &progress};
+
+ GraphTraverser gt{clargs.gtargs, &exec_context, [](auto done, auto cv) {}};
auto const result =
gt.BuildAndStage(clargs.graph_description, clargs.artifacts);
@@ -573,13 +574,13 @@ static void TestTreesUsed(
auto const apis =
ApiBundle::Create(&local_context, &remote_context, p.GetRepoConfig());
- GraphTraverser gt{clargs.gtargs,
- p.GetRepoConfig(),
- &remote_context,
- &stats,
- &progress,
- &apis,
- [](auto done, auto cv) {}};
+ ExecutionContext const exec_context{.repo_config = p.GetRepoConfig(),
+ .apis = &apis,
+ .remote_context = &remote_context,
+ .statistics = &stats,
+ .progress = &progress};
+
+ GraphTraverser gt{clargs.gtargs, &exec_context, [](auto done, auto cv) {}};
auto const result =
gt.BuildAndStage(clargs.graph_description, clargs.artifacts);
@@ -630,13 +631,13 @@ static void TestNestedTreesUsed(
auto const apis =
ApiBundle::Create(&local_context, &remote_context, p.GetRepoConfig());
- GraphTraverser gt{clargs.gtargs,
- p.GetRepoConfig(),
- &remote_context,
- &stats,
- &progress,
- &apis,
- [](auto done, auto cv) {}};
+ ExecutionContext const exec_context{.repo_config = p.GetRepoConfig(),
+ .apis = &apis,
+ .remote_context = &remote_context,
+ .statistics = &stats,
+ .progress = &progress};
+
+ GraphTraverser gt{clargs.gtargs, &exec_context, [](auto done, auto cv) {}};
auto const result =
gt.BuildAndStage(clargs.graph_description, clargs.artifacts);
@@ -686,15 +687,16 @@ static void TestFlakyHelloWorldDetected(
auto const apis =
ApiBundle::Create(&local_context, &remote_context, p.GetRepoConfig());
+ ExecutionContext const exec_context{.repo_config = p.GetRepoConfig(),
+ .apis = &apis,
+ .remote_context = &remote_context,
+ .statistics = &stats,
+ .progress = &progress};
+
{
auto clargs = p.CmdLineArgs("_entry_points_ctimes");
- GraphTraverser const gt{clargs.gtargs,
- p.GetRepoConfig(),
- &remote_context,
- &stats,
- &progress,
- &apis,
- [](auto done, auto cv) {}};
+ GraphTraverser const gt{
+ clargs.gtargs, &exec_context, [](auto done, auto cv) {}};
auto const result =
gt.BuildAndStage(clargs.graph_description, clargs.artifacts);
@@ -708,13 +710,8 @@ static void TestFlakyHelloWorldDetected(
// make_exe[flaky]->make_output[miss]
auto clargs_output = p.CmdLineArgs();
clargs_output.gtargs.rebuild = RebuildArguments{};
- GraphTraverser const gt_output{clargs_output.gtargs,
- p.GetRepoConfig(),
- &remote_context,
- &stats,
- &progress,
- &apis,
- [](auto done, auto cv) {}};
+ GraphTraverser const gt_output{
+ clargs_output.gtargs, &exec_context, [](auto done, auto cv) {}};
REQUIRE(gt_output.BuildAndStage(clargs_output.graph_description,
clargs_output.artifacts));
CHECK(stats.ActionsFlakyCounter() == 1);
@@ -725,13 +722,8 @@ static void TestFlakyHelloWorldDetected(
// make_exe[flaky]->make_output[miss]->strip_time [miss]
auto clargs_stripped = p.CmdLineArgs("_entry_points_stripped");
clargs_stripped.gtargs.rebuild = RebuildArguments{};
- GraphTraverser const gt_stripped{clargs_stripped.gtargs,
- p.GetRepoConfig(),
- &remote_context,
- &stats,
- &progress,
- &apis,
- [](auto done, auto cv) {}};
+ GraphTraverser const gt_stripped{
+ clargs_stripped.gtargs, &exec_context, [](auto done, auto cv) {}};
REQUIRE(gt_stripped.BuildAndStage(clargs_stripped.graph_description,
clargs_stripped.artifacts));
CHECK(stats.ActionsFlakyCounter() == 1);
@@ -742,13 +734,8 @@ static void TestFlakyHelloWorldDetected(
// make_exe[flaky]->make_output[miss]->strip_time[miss]->list_ctimes [flaky]
auto clargs_ctimes = p.CmdLineArgs("_entry_points_ctimes");
clargs_ctimes.gtargs.rebuild = RebuildArguments{};
- GraphTraverser const gt_ctimes{clargs_ctimes.gtargs,
- p.GetRepoConfig(),
- &remote_context,
- &stats,
- &progress,
- &apis,
- [](auto done, auto cv) {}};
+ GraphTraverser const gt_ctimes{
+ clargs_ctimes.gtargs, &exec_context, [](auto done, auto cv) {}};
REQUIRE(gt_ctimes.BuildAndStage(clargs_ctimes.graph_description,
clargs_ctimes.artifacts));
CHECK(stats.ActionsFlakyCounter() == 2);