summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-07-22 16:44:49 +0200
committerPaul Cristian Sarbu <paul.cristian.sarbu@huawei.com>2024-07-23 10:24:39 +0200
commitec5e4b0290edff5d9589898493cd7d08f3fb5cd3 (patch)
tree23179bc88ee1fa5c6289e33869d88900d0be284a
parent9c9175b8658cade244272464ede3c21be34df172 (diff)
downloadjustbuild-ec5e4b0290edff5d9589898493cd7d08f3fb5cd3.tar.gz
just-mr: Use progress instance in setup maps
...instead of using the singleton.
-rw-r--r--src/other_tools/just_mr/fetch.cpp2
-rw-r--r--src/other_tools/just_mr/setup.cpp4
-rw-r--r--src/other_tools/ops_maps/TARGETS6
-rw-r--r--src/other_tools/ops_maps/content_cas_map.cpp36
-rw-r--r--src/other_tools/ops_maps/content_cas_map.hpp2
-rw-r--r--src/other_tools/ops_maps/git_tree_fetch_map.cpp24
-rw-r--r--src/other_tools/ops_maps/git_tree_fetch_map.hpp2
-rw-r--r--src/other_tools/root_maps/TARGETS6
-rw-r--r--src/other_tools/root_maps/commit_git_map.cpp58
-rw-r--r--src/other_tools/root_maps/commit_git_map.hpp2
-rw-r--r--src/other_tools/root_maps/content_git_map.cpp24
-rw-r--r--src/other_tools/root_maps/content_git_map.hpp2
12 files changed, 99 insertions, 69 deletions
diff --git a/src/other_tools/just_mr/fetch.cpp b/src/other_tools/just_mr/fetch.cpp
index 328f0d74..2e4346da 100644
--- a/src/other_tools/just_mr/fetch.cpp
+++ b/src/other_tools/just_mr/fetch.cpp
@@ -487,6 +487,7 @@ auto MultiRepoFetch(std::shared_ptr<Configuration> const& config,
&storage,
&(*apis.local),
has_remote_api ? &*apis.remote : nullptr,
+ &JustMRProgress::Instance(),
common_args.jobs);
auto archive_fetch_map = CreateArchiveFetchMap(
@@ -515,6 +516,7 @@ auto MultiRepoFetch(std::shared_ptr<Configuration> const& config,
&(*apis.local),
has_remote_api ? &*apis.remote : nullptr,
fetch_args.backup_to_remote,
+ &JustMRProgress::Instance(),
common_args.jobs);
// set up progress observer
diff --git a/src/other_tools/just_mr/setup.cpp b/src/other_tools/just_mr/setup.cpp
index 8359fec7..a2281ead 100644
--- a/src/other_tools/just_mr/setup.cpp
+++ b/src/other_tools/just_mr/setup.cpp
@@ -206,6 +206,7 @@ auto MultiRepoSetup(std::shared_ptr<Configuration> const& config,
&storage,
&(*apis.local),
has_remote_api ? &*apis.remote : nullptr,
+ &JustMRProgress::Instance(),
common_args.jobs);
auto import_to_git_map =
@@ -225,6 +226,7 @@ auto MultiRepoSetup(std::shared_ptr<Configuration> const& config,
&(*apis.local),
has_remote_api ? &*apis.remote : nullptr,
false, /* backup_to_remote */
+ &JustMRProgress::Instance(),
common_args.jobs);
auto resolve_symlinks_map = CreateResolveSymlinksMap();
@@ -241,6 +243,7 @@ auto MultiRepoSetup(std::shared_ptr<Configuration> const& config,
&(*apis.local),
has_remote_api ? &*apis.remote : nullptr,
common_args.fetch_absent,
+ &JustMRProgress::Instance(),
common_args.jobs);
auto content_git_map =
@@ -256,6 +259,7 @@ auto MultiRepoSetup(std::shared_ptr<Configuration> const& config,
&storage,
has_remote_api ? &*apis.remote : nullptr,
common_args.fetch_absent,
+ &JustMRProgress::Instance(),
common_args.jobs);
auto foreign_file_git_map =
diff --git a/src/other_tools/ops_maps/TARGETS b/src/other_tools/ops_maps/TARGETS
index d564dc41..798be3e8 100644
--- a/src/other_tools/ops_maps/TARGETS
+++ b/src/other_tools/ops_maps/TARGETS
@@ -65,6 +65,7 @@
, ["src/buildtool/execution_api/common", "common"]
, ["src/buildtool/multithreading", "async_map_consumer"]
, ["src/other_tools/just_mr", "mirrors"]
+ , ["src/other_tools/just_mr/progress_reporting", "progress"]
, ["src/other_tools/ops_maps", "critical_git_op_map"]
, ["src/utils/cpp", "hash_combine"]
, ["src/buildtool/serve_api/remote", "serve_api"]
@@ -78,8 +79,6 @@
, ["src/buildtool/file_system", "file_storage"]
, ["src/buildtool/storage", "fs_utils"]
, ["src/other_tools/git_operations", "git_repo_remote"]
- , ["src/other_tools/just_mr/progress_reporting", "statistics"]
- , ["src/other_tools/just_mr/progress_reporting", "progress"]
]
}
, "archive_fetch_map":
@@ -111,6 +110,7 @@
, "deps":
[ ["@", "gsl", "", "gsl"]
, ["src/buildtool/execution_api/common", "common"]
+ , ["src/other_tools/just_mr/progress_reporting", "progress"]
, ["src/other_tools/ops_maps", "critical_git_op_map"]
, ["src/other_tools/ops_maps", "import_to_git_map"]
, ["src/buildtool/serve_api/remote", "serve_api"]
@@ -125,8 +125,6 @@
, ["src/buildtool/multithreading", "task_system"]
, ["src/buildtool/system", "system_command"]
, ["src/other_tools/git_operations", "git_repo_remote"]
- , ["src/other_tools/just_mr/progress_reporting", "progress"]
- , ["src/other_tools/just_mr/progress_reporting", "statistics"]
, ["src/other_tools/ops_maps", "content_cas_map"]
, ["src/other_tools/ops_maps", "import_to_git_map"]
, ["src/buildtool/execution_api/git", "git"]
diff --git a/src/other_tools/ops_maps/content_cas_map.cpp b/src/other_tools/ops_maps/content_cas_map.cpp
index cacee577..b53da0a0 100644
--- a/src/other_tools/ops_maps/content_cas_map.cpp
+++ b/src/other_tools/ops_maps/content_cas_map.cpp
@@ -20,8 +20,6 @@
#include "src/buildtool/file_system/file_storage.hpp"
#include "src/buildtool/storage/fs_utils.hpp"
#include "src/other_tools/git_operations/git_repo_remote.hpp"
-#include "src/other_tools/just_mr/progress_reporting/progress.hpp"
-#include "src/other_tools/just_mr/progress_reporting/statistics.hpp"
#include "src/other_tools/utils/content.hpp"
#include "src/other_tools/utils/curl_url_handle.hpp"
@@ -31,6 +29,7 @@ void FetchFromNetwork(ArchiveContent const& key,
MirrorsPtr const& additional_mirrors,
CAInfoPtr const& ca_info,
Storage const& storage,
+ gsl::not_null<JustMRProgress*> const& progress,
ContentCASMap::SetterPtr const& setter,
ContentCASMap::LoggerPtr const& logger) {
// first, check that mandatory fields are provided
@@ -93,7 +92,7 @@ void FetchFromNetwork(ArchiveContent const& key,
/*fatal=*/true);
return;
}
- JustMRProgress::Instance().TaskTracker().Stop(key.origin);
+ progress->TaskTracker().Stop(key.origin);
// success!
(*setter)(nullptr);
}
@@ -110,6 +109,7 @@ auto CreateContentCASMap(
gsl::not_null<Storage const*> const& storage,
gsl::not_null<IExecutionApi const*> const& local_api,
IExecutionApi const* remote_api,
+ gsl::not_null<JustMRProgress*> const& progress,
std::size_t jobs) -> ContentCASMap {
auto ensure_in_cas = [just_mr_paths,
additional_mirrors,
@@ -119,11 +119,12 @@ auto CreateContentCASMap(
storage,
storage_config,
local_api,
- remote_api](auto ts,
- auto setter,
- auto logger,
- auto /*unused*/,
- auto const& key) {
+ remote_api,
+ progress](auto ts,
+ auto setter,
+ auto logger,
+ auto /*unused*/,
+ auto const& key) {
auto digest = ArtifactDigest(key.content, 0, false);
// check local CAS
if (local_api->IsAvailable(digest)) {
@@ -153,6 +154,7 @@ auto CreateContentCASMap(
storage,
local_api,
remote_api,
+ progress,
setter,
logger](auto const& values) {
GitOpValue op_result = *values[0];
@@ -201,7 +203,7 @@ auto CreateContentCASMap(
return;
}
// blob not found in Git cache
- JustMRProgress::Instance().TaskTracker().Start(key.origin);
+ progress->TaskTracker().Start(key.origin);
// add distfile to CAS
auto repo_distfile =
(key.distfile ? key.distfile.value()
@@ -212,7 +214,7 @@ auto CreateContentCASMap(
*storage, repo_distfile, just_mr_paths);
// check if content is in CAS now
if (cas.BlobPath(digest, /*is_executable=*/false)) {
- JustMRProgress::Instance().TaskTracker().Stop(key.origin);
+ progress->TaskTracker().Stop(key.origin);
(*setter)(nullptr);
return;
}
@@ -224,8 +226,7 @@ auto CreateContentCASMap(
{Artifact::ObjectInfo{.digest = digest,
.type = ObjectType::File}},
*local_api)) {
- JustMRProgress::Instance().TaskTracker().Stop(
- key.origin);
+ progress->TaskTracker().Stop(key.origin);
(*setter)(nullptr);
return;
}
@@ -236,13 +237,18 @@ auto CreateContentCASMap(
{Artifact::ObjectInfo{.digest = digest,
.type = ObjectType::File}},
*local_api)) {
- JustMRProgress::Instance().TaskTracker().Stop(key.origin);
+ progress->TaskTracker().Stop(key.origin);
(*setter)(nullptr);
return;
}
// revert to network fetch
- FetchFromNetwork(
- key, additional_mirrors, ca_info, *storage, setter, logger);
+ FetchFromNetwork(key,
+ additional_mirrors,
+ ca_info,
+ *storage,
+ progress,
+ setter,
+ logger);
},
[logger, target_path = storage_config->GitRoot()](auto const& msg,
bool fatal) {
diff --git a/src/other_tools/ops_maps/content_cas_map.hpp b/src/other_tools/ops_maps/content_cas_map.hpp
index 27bb9429..ccfb6dad 100644
--- a/src/other_tools/ops_maps/content_cas_map.hpp
+++ b/src/other_tools/ops_maps/content_cas_map.hpp
@@ -29,6 +29,7 @@
#include "src/buildtool/storage/config.hpp"
#include "src/buildtool/storage/storage.hpp"
#include "src/other_tools/just_mr/mirrors.hpp"
+#include "src/other_tools/just_mr/progress_reporting/progress.hpp"
#include "src/other_tools/ops_maps/critical_git_op_map.hpp"
#include "src/utils/cpp/hash_combine.hpp"
@@ -91,6 +92,7 @@ using ContentCASMap = AsyncMapConsumer<ArchiveContent, std::nullptr_t>;
gsl::not_null<Storage const*> const& storage,
gsl::not_null<IExecutionApi const*> const& local_api,
IExecutionApi const* remote_api,
+ gsl::not_null<JustMRProgress*> const& progress,
std::size_t jobs) -> ContentCASMap;
namespace std {
diff --git a/src/other_tools/ops_maps/git_tree_fetch_map.cpp b/src/other_tools/ops_maps/git_tree_fetch_map.cpp
index f88f5d46..f70ee619 100644
--- a/src/other_tools/ops_maps/git_tree_fetch_map.cpp
+++ b/src/other_tools/ops_maps/git_tree_fetch_map.cpp
@@ -27,8 +27,6 @@
#include "src/buildtool/multithreading/task_system.hpp"
#include "src/buildtool/system/system_command.hpp"
#include "src/other_tools/git_operations/git_repo_remote.hpp"
-#include "src/other_tools/just_mr/progress_reporting/progress.hpp"
-#include "src/other_tools/just_mr/progress_reporting/statistics.hpp"
namespace {
@@ -134,6 +132,7 @@ auto CreateGitTreeFetchMap(
gsl::not_null<IExecutionApi const*> const& local_api,
IExecutionApi const* remote_api,
bool backup_to_remote,
+ gsl::not_null<JustMRProgress*> const& progress,
std::size_t jobs) -> GitTreeFetchMap {
auto tree_to_cache = [critical_git_op_map,
import_to_git_map,
@@ -143,11 +142,12 @@ auto CreateGitTreeFetchMap(
storage_config,
local_api,
remote_api,
- backup_to_remote](auto ts,
- auto setter,
- auto logger,
- auto /*unused*/,
- auto const& key) {
+ backup_to_remote,
+ progress](auto ts,
+ auto setter,
+ auto logger,
+ auto /*unused*/,
+ auto const& key) {
// check whether tree exists already in Git cache;
// ensure Git cache exists
GitOpKey op_key = {.params =
@@ -172,6 +172,7 @@ auto CreateGitTreeFetchMap(
remote_api,
backup_to_remote,
key,
+ progress,
ts,
setter,
logger](auto const& values) {
@@ -233,7 +234,7 @@ auto CreateGitTreeFetchMap(
// done!
return;
}
- JustMRProgress::Instance().TaskTracker().Start(key.origin);
+ progress->TaskTracker().Start(key.origin);
// check if tree is known to remote serve service and can be
// made available in remote CAS
if (serve != nullptr and remote_api != nullptr) {
@@ -248,7 +249,7 @@ auto CreateGitTreeFetchMap(
{Artifact::ObjectInfo{.digest = digest,
.type = ObjectType::Tree}},
*local_api)) {
- JustMRProgress::Instance().TaskTracker().Stop(key.origin);
+ progress->TaskTracker().Stop(key.origin);
MoveCASTreeToGit(
key.hash,
digest,
@@ -326,6 +327,7 @@ auto CreateGitTreeFetchMap(
storage_config,
remote_api,
backup_to_remote,
+ progress,
ts,
setter,
logger](auto const& values) {
@@ -463,6 +465,7 @@ auto CreateGitTreeFetchMap(
storage_config,
backup_to_remote,
key,
+ progress,
setter,
logger](auto const& values) {
GitOpValue op_result = *values[0];
@@ -472,8 +475,7 @@ auto CreateGitTreeFetchMap(
/*fatal=*/true);
return;
}
- JustMRProgress::Instance().TaskTracker().Stop(
- key.origin);
+ progress->TaskTracker().Stop(key.origin);
// backup to remote if needed and in native mode
if (backup_to_remote and
remote_api != nullptr) {
diff --git a/src/other_tools/ops_maps/git_tree_fetch_map.hpp b/src/other_tools/ops_maps/git_tree_fetch_map.hpp
index e61e1264..6a2c101c 100644
--- a/src/other_tools/ops_maps/git_tree_fetch_map.hpp
+++ b/src/other_tools/ops_maps/git_tree_fetch_map.hpp
@@ -25,6 +25,7 @@
#include "src/buildtool/execution_api/common/execution_api.hpp"
#include "src/buildtool/serve_api/remote/serve_api.hpp"
#include "src/buildtool/storage/config.hpp"
+#include "src/other_tools/just_mr/progress_reporting/progress.hpp"
#include "src/other_tools/ops_maps/critical_git_op_map.hpp"
#include "src/other_tools/ops_maps/import_to_git_map.hpp"
@@ -66,6 +67,7 @@ using GitTreeFetchMap = AsyncMapConsumer<GitTreeInfo, bool>;
gsl::not_null<IExecutionApi const*> const& local_api,
IExecutionApi const* remote_api,
bool backup_to_remote,
+ gsl::not_null<JustMRProgress*> const& progress,
std::size_t jobs) -> GitTreeFetchMap;
#endif // INCLUDED_SRC_OTHER_TOOLS_OPS_MAPS_GIT_TREE_FETCH_MAP_HPP
diff --git a/src/other_tools/root_maps/TARGETS b/src/other_tools/root_maps/TARGETS
index bbecf905..d4d1e4ba 100644
--- a/src/other_tools/root_maps/TARGETS
+++ b/src/other_tools/root_maps/TARGETS
@@ -43,6 +43,7 @@
, ["src/buildtool/execution_api/common", "common"]
, ["src/buildtool/serve_api/remote", "serve_api"]
, ["src/other_tools/just_mr", "mirrors"]
+ , ["src/other_tools/just_mr/progress_reporting", "progress"]
, ["src/other_tools/ops_maps", "critical_git_op_map"]
, ["src/other_tools/ops_maps", "import_to_git_map"]
, ["src/utils/cpp", "hash_combine"]
@@ -58,8 +59,6 @@
, ["src/buildtool/multithreading", "task_system"]
, ["src/buildtool/storage", "fs_utils"]
, ["src/other_tools/git_operations", "git_repo_remote"]
- , ["src/other_tools/just_mr/progress_reporting", "progress"]
- , ["src/other_tools/just_mr/progress_reporting", "statistics"]
, ["src/other_tools/utils", "curl_url_handle"]
, ["src/utils/cpp", "tmp_dir"]
]
@@ -108,6 +107,7 @@
, ["src/buildtool/execution_api/common", "common"]
, ["src/buildtool/file_system/symlinks_map", "resolve_symlinks_map"]
, ["src/other_tools/just_mr", "mirrors"]
+ , ["src/other_tools/just_mr/progress_reporting", "progress"]
, ["src/other_tools/ops_maps", "content_cas_map"]
, ["src/other_tools/ops_maps", "import_to_git_map"]
, ["src/buildtool/serve_api/remote", "serve_api"]
@@ -126,8 +126,6 @@
, ["src/buildtool/multithreading", "task_system"]
, ["src/buildtool/storage", "fs_utils"]
, ["src/other_tools/git_operations", "git_repo_remote"]
- , ["src/other_tools/just_mr/progress_reporting", "progress"]
- , ["src/other_tools/just_mr/progress_reporting", "statistics"]
, ["src/other_tools/utils", "content"]
, ["src/utils/archive", "archive_ops"]
]
diff --git a/src/other_tools/root_maps/commit_git_map.cpp b/src/other_tools/root_maps/commit_git_map.cpp
index fda8802c..8efd628a 100644
--- a/src/other_tools/root_maps/commit_git_map.cpp
+++ b/src/other_tools/root_maps/commit_git_map.cpp
@@ -24,8 +24,6 @@
#include "src/buildtool/multithreading/task_system.hpp"
#include "src/buildtool/storage/fs_utils.hpp"
#include "src/other_tools/git_operations/git_repo_remote.hpp"
-#include "src/other_tools/just_mr/progress_reporting/progress.hpp"
-#include "src/other_tools/just_mr/progress_reporting/statistics.hpp"
#include "src/other_tools/root_maps/root_utils.hpp"
#include "src/other_tools/utils/curl_url_handle.hpp"
#include "src/utils/cpp/path.hpp"
@@ -195,6 +193,7 @@ void TagAndSetRoot(std::filesystem::path const& repo_root,
bool finish_task,
GitCASPtr const& git_cas,
gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map,
+ gsl::not_null<JustMRProgress*> const& progress,
gsl::not_null<TaskSystem*> const& ts,
CommitGitMap::SetterPtr const& ws_setter,
CommitGitMap::LoggerPtr const& logger) {
@@ -209,8 +208,13 @@ void TagAndSetRoot(std::filesystem::path const& repo_root,
critical_git_op_map->ConsumeAfterKeysReady(
ts,
{std::move(op_key)},
- [git_cas, repo_info, repo_root, ws_setter, logger, finish_task](
- auto const& values) {
+ [git_cas,
+ repo_info,
+ repo_root,
+ progress,
+ ws_setter,
+ logger,
+ finish_task](auto const& values) {
GitOpValue op_result = *values[0];
// check flag
if (not op_result.result) {
@@ -242,7 +246,7 @@ void TagAndSetRoot(std::filesystem::path const& repo_root,
}
// set the workspace root as present
if (finish_task) {
- JustMRProgress::Instance().TaskTracker().Stop(repo_info.origin);
+ progress->TaskTracker().Stop(repo_info.origin);
}
(*ws_setter)(
std::pair(nlohmann::json::array(
@@ -269,6 +273,7 @@ void TakeCommitFromOlderGeneration(
GitRepoInfo const& repo_info,
GitCASPtr const& git_cas,
gsl::not_null<CriticalGitOpMap*> const& critical_git_op_map,
+ gsl::not_null<JustMRProgress*> const& progress,
gsl::not_null<TaskSystem*> const& ts,
CommitGitMap::SetterPtr const& ws_setter,
CommitGitMap::LoggerPtr const& logger) {
@@ -290,6 +295,7 @@ void TakeCommitFromOlderGeneration(
source,
repo_info,
critical_git_op_map,
+ progress,
ts,
ws_setter](auto const& values) {
GitOpValue op_result = *values[0];
@@ -323,6 +329,7 @@ void TakeCommitFromOlderGeneration(
false,
git_cas,
critical_git_op_map,
+ progress,
ts,
ws_setter,
logger);
@@ -347,6 +354,7 @@ void NetworkFetchAndSetPresentRoot(
std::string const& git_bin,
std::vector<std::string> const& launcher,
bool fetch_absent,
+ gsl::not_null<JustMRProgress*> const& progress,
gsl::not_null<TaskSystem*> const& ts,
CommitGitMap::SetterPtr const& ws_setter,
CommitGitMap::LoggerPtr const& logger) {
@@ -454,6 +462,7 @@ void NetworkFetchAndSetPresentRoot(
true,
git_cas,
critical_git_op_map,
+ progress,
ts,
ws_setter,
logger);
@@ -480,7 +489,7 @@ void NetworkFetchAndSetPresentRoot(
return;
}
// set the workspace root as present
- JustMRProgress::Instance().TaskTracker().Stop(repo_info.origin);
+ progress->TaskTracker().Stop(repo_info.origin);
(*ws_setter)(std::pair(
nlohmann::json::array({repo_info.ignore_special
? FileRoot::kGitTreeIgnoreSpecialMarker
@@ -510,6 +519,7 @@ void EnsureCommit(GitRepoInfo const& repo_info,
gsl::not_null<IExecutionApi const*> const& local_api,
IExecutionApi const* remote_api,
bool fetch_absent,
+ gsl::not_null<JustMRProgress*> const& progress,
gsl::not_null<TaskSystem*> const& ts,
CommitGitMap::SetterPtr const& ws_setter,
CommitGitMap::LoggerPtr const& logger) {
@@ -620,6 +630,7 @@ void EnsureCommit(GitRepoInfo const& repo_info,
repo_info,
git_cas,
critical_git_op_map,
+ progress,
ts,
ws_setter,
logger);
@@ -632,7 +643,7 @@ void EnsureCommit(GitRepoInfo const& repo_info,
// older generations
// Not present locally, we have to fetch
- JustMRProgress::Instance().TaskTracker().Start(repo_info.origin);
+ progress->TaskTracker().Start(repo_info.origin);
// check if commit is known to remote serve service
if (serve != nullptr) {
// if root purely absent, request only the subdir tree
@@ -643,8 +654,7 @@ void EnsureCommit(GitRepoInfo const& repo_info,
/*sync_tree = */ false);
if (serve_result) {
// set the workspace root as absent
- JustMRProgress::Instance().TaskTracker().Stop(
- repo_info.origin);
+ progress->TaskTracker().Stop(repo_info.origin);
(*ws_setter)(std::pair(
nlohmann::json::array(
{repo_info.ignore_special
@@ -702,6 +712,7 @@ void EnsureCommit(GitRepoInfo const& repo_info,
local_api,
remote_api,
fetch_absent,
+ progress,
ts,
ws_setter,
logger](auto const& values) {
@@ -744,8 +755,7 @@ void EnsureCommit(GitRepoInfo const& repo_info,
return;
}
if (*tree_present) {
- JustMRProgress::Instance().TaskTracker().Stop(
- repo_info.origin);
+ progress->TaskTracker().Stop(repo_info.origin);
// write association to id file, get subdir
// tree, and set the workspace root as present
WriteIdFileAndSetWSRoot(
@@ -796,9 +806,8 @@ void EnsureCommit(GitRepoInfo const& repo_info,
return;
}
if (*tree_present) {
- JustMRProgress::Instance()
- .TaskTracker()
- .Stop(repo_info.origin);
+ progress->TaskTracker().Stop(
+ repo_info.origin);
// get subdir tree and set the workspace
// root as present; as this tree is not in
// our Git cache, no file association should
@@ -849,8 +858,7 @@ void EnsureCommit(GitRepoInfo const& repo_info,
.digest = root_digest,
.type = ObjectType::Tree}},
*local_api)) {
- JustMRProgress::Instance().TaskTracker().Stop(
- repo_info.origin);
+ progress->TaskTracker().Stop(repo_info.origin);
// Move tree from local CAS to local Git storage
auto tmp_dir =
storage_config->CreateTypedTmpDir(
@@ -956,6 +964,7 @@ void EnsureCommit(GitRepoInfo const& repo_info,
git_bin,
launcher,
fetch_absent,
+ progress,
ts,
ws_setter,
logger);
@@ -996,13 +1005,14 @@ void EnsureCommit(GitRepoInfo const& repo_info,
git_bin,
launcher,
fetch_absent,
+ progress,
ts,
ws_setter,
logger);
}
else {
// commit is present in given repository
- JustMRProgress::Instance().TaskTracker().Start(repo_info.origin);
+ progress->TaskTracker().Start(repo_info.origin);
// setup wrapped logger
auto wrapped_logger = std::make_shared<AsyncMapConsumerLogger>(
[logger](auto const& msg, bool fatal) {
@@ -1057,6 +1067,7 @@ auto CreateCommitGitMap(
gsl::not_null<IExecutionApi const*> const& local_api,
IExecutionApi const* remote_api,
bool fetch_absent,
+ gsl::not_null<JustMRProgress*> const& progress,
std::size_t jobs) -> CommitGitMap {
auto commit_to_git = [critical_git_op_map,
import_to_git_map,
@@ -1068,11 +1079,12 @@ auto CreateCommitGitMap(
storage_config,
local_api,
remote_api,
- fetch_absent](auto ts,
- auto setter,
- auto logger,
- auto /* unused */,
- auto const& key) {
+ fetch_absent,
+ progress](auto ts,
+ auto setter,
+ auto logger,
+ auto /* unused */,
+ auto const& key) {
// get root for repo (making sure that if repo is a path, it is
// absolute)
std::string fetch_repo = key.repo_url;
@@ -1111,6 +1123,7 @@ auto CreateCommitGitMap(
local_api,
remote_api,
fetch_absent,
+ progress,
ts,
setter,
logger](auto const& values) {
@@ -1145,6 +1158,7 @@ auto CreateCommitGitMap(
local_api,
remote_api,
fetch_absent,
+ progress,
ts,
setter,
wrapped_logger);
diff --git a/src/other_tools/root_maps/commit_git_map.hpp b/src/other_tools/root_maps/commit_git_map.hpp
index b1894464..1916ce13 100644
--- a/src/other_tools/root_maps/commit_git_map.hpp
+++ b/src/other_tools/root_maps/commit_git_map.hpp
@@ -28,6 +28,7 @@
#include "src/buildtool/serve_api/remote/serve_api.hpp"
#include "src/buildtool/storage/config.hpp"
#include "src/other_tools/just_mr/mirrors.hpp"
+#include "src/other_tools/just_mr/progress_reporting/progress.hpp"
#include "src/other_tools/ops_maps/critical_git_op_map.hpp"
#include "src/other_tools/ops_maps/import_to_git_map.hpp"
#include "src/utils/cpp/hash_combine.hpp"
@@ -87,6 +88,7 @@ using CommitGitMap =
gsl::not_null<IExecutionApi const*> const& local_api,
IExecutionApi const* remote_api,
bool fetch_absent,
+ gsl::not_null<JustMRProgress*> const& progress,
std::size_t jobs) -> CommitGitMap;
#endif // INCLUDED_SRC_OTHER_TOOLS_ROOT_MAPS_COMMIT_GIT_MAP_HPP
diff --git a/src/other_tools/root_maps/content_git_map.cpp b/src/other_tools/root_maps/content_git_map.cpp
index e3f4c76d..652f4a25 100644
--- a/src/other_tools/root_maps/content_git_map.cpp
+++ b/src/other_tools/root_maps/content_git_map.cpp
@@ -21,8 +21,6 @@
#include "src/buildtool/multithreading/async_map_utils.hpp"
#include "src/buildtool/multithreading/task_system.hpp"
#include "src/buildtool/storage/fs_utils.hpp"
-#include "src/other_tools/just_mr/progress_reporting/progress.hpp"
-#include "src/other_tools/just_mr/progress_reporting/statistics.hpp"
#include "src/other_tools/root_maps/root_utils.hpp"
#include "src/other_tools/utils/content.hpp"
#include "src/utils/archive/archive_ops.hpp"
@@ -911,6 +909,7 @@ auto CreateContentGitMap(
gsl::not_null<Storage const*> const& storage,
IExecutionApi const* remote_api,
bool fetch_absent,
+ gsl::not_null<JustMRProgress*> const& progress,
std::size_t jobs) -> ContentGitMap {
auto gitify_content = [content_cas_map,
import_to_git_map,
@@ -923,11 +922,12 @@ auto CreateContentGitMap(
storage,
storage_config,
remote_api,
- fetch_absent](auto ts,
- auto setter,
- auto logger,
- auto /* unused */,
- auto const& key) {
+ fetch_absent,
+ progress](auto ts,
+ auto setter,
+ auto logger,
+ auto /* unused */,
+ auto const& key) {
auto archive_tree_id_file = StorageUtils::GetArchiveTreeIDFile(
*storage_config, key.repo_type, key.archive.content);
if (FileSystemManager::Exists(archive_tree_id_file)) {
@@ -972,8 +972,7 @@ auto CreateContentGitMap(
/*sync_tree = */ false);
if (serve_result) {
// set the workspace root as absent
- JustMRProgress::Instance().TaskTracker().Stop(
- key.archive.origin);
+ progress->TaskTracker().Stop(key.archive.origin);
(*setter)(std::pair(
nlohmann::json::array(
{FileRoot::kGitTreeMarker, *serve_result}),
@@ -1045,6 +1044,7 @@ auto CreateContentGitMap(
storage,
storage_config,
remote_api,
+ progress,
ts,
setter,
logger](auto const& values) {
@@ -1118,8 +1118,7 @@ auto CreateContentGitMap(
/*fatal=*/true);
return;
}
- JustMRProgress::Instance().TaskTracker().Start(
- key.archive.origin);
+ progress->TaskTracker().Start(key.archive.origin);
// add distfile to CAS
auto repo_distfile =
(key.archive.distfile
@@ -1132,8 +1131,7 @@ auto CreateContentGitMap(
// check if content is in CAS now
if (auto content_cas_path =
cas.BlobPath(digest, /*is_executable=*/false)) {
- JustMRProgress::Instance().TaskTracker().Stop(
- key.archive.origin);
+ progress->TaskTracker().Stop(key.archive.origin);
ExtractAndImportToGit(key,
*content_cas_path,
archive_tree_id_file,
diff --git a/src/other_tools/root_maps/content_git_map.hpp b/src/other_tools/root_maps/content_git_map.hpp
index ddf922f4..e969f20a 100644
--- a/src/other_tools/root_maps/content_git_map.hpp
+++ b/src/other_tools/root_maps/content_git_map.hpp
@@ -28,6 +28,7 @@
#include "src/buildtool/storage/config.hpp"
#include "src/buildtool/storage/storage.hpp"
#include "src/other_tools/just_mr/mirrors.hpp"
+#include "src/other_tools/just_mr/progress_reporting/progress.hpp"
#include "src/other_tools/ops_maps/content_cas_map.hpp"
#include "src/other_tools/ops_maps/import_to_git_map.hpp"
@@ -50,6 +51,7 @@ using ContentGitMap =
gsl::not_null<Storage const*> const& storage,
IExecutionApi const* remote_api,
bool fetch_absent,
+ gsl::not_null<JustMRProgress*> const& progress,
std::size_t jobs) -> ContentGitMap;
#endif // INCLUDED_SRC_OTHER_TOOLS_ROOT_MAPS_CONTENT_GIT_MAP_HPP