From 7104c7f1dc04187bd23e9499f247d628592e0dd8 Mon Sep 17 00:00:00 2001 From: Klaus Aehlig Date: Fri, 17 Mar 2023 11:40:57 +0100 Subject: just-mr: rework progress reporting and statistics To avoid unnecessary work, just-mr uses on-disk caches, including for the mapping of a distdir to the corresponding git tree. This, however, implies that the number of repositories that are actually considered varies: in order to fetch a distdir repository, all involved archives have to be fetched, but if we have a cache hit none of them is even looked at. So, in order to have a consistent reporting only count top-level targets (i.e., the reachable repositories) in the statistics, not the archives implicitly contained in a distdir, nor low-level sub tasks. The actual fetch acitvity is shown separately by the task tracker. --- src/other_tools/root_maps/commit_git_map.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'src/other_tools/root_maps/commit_git_map.cpp') diff --git a/src/other_tools/root_maps/commit_git_map.cpp b/src/other_tools/root_maps/commit_git_map.cpp index 5e63e699..fae205ed 100644 --- a/src/other_tools/root_maps/commit_git_map.cpp +++ b/src/other_tools/root_maps/commit_git_map.cpp @@ -59,9 +59,7 @@ void EnsureCommit(GitRepoInfo const& repo_info, return; } if (not is_commit_present.value()) { - // start work reporting JustMRProgress::Instance().TaskTracker().Start(repo_info.origin); - JustMRStatistics::Instance().IncrementQueuedCounter(); // if commit not there, fetch it auto tmp_dir = JustMR::Utils::CreateTypedTmpDir("fetch"); if (not tmp_dir) { @@ -147,11 +145,10 @@ void EnsureCommit(GitRepoInfo const& repo_info, return; } // set the workspace root - (*ws_setter)( - nlohmann::json::array({"git tree", *subtree, repo_root})); - // report work done JustMRProgress::Instance().TaskTracker().Stop(repo_info.origin); - JustMRStatistics::Instance().IncrementExecutedCounter(); + (*ws_setter)(std::pair( + nlohmann::json::array({"git tree", *subtree, repo_root}), + false)); }, [logger, target_path = repo_root](auto const& msg, bool fatal) { (*logger)(fmt::format("While running critical Git op " @@ -176,9 +173,8 @@ void EnsureCommit(GitRepoInfo const& repo_info, return; } // set the workspace root - (*ws_setter)(nlohmann::json::array({"git tree", *subtree, repo_root})); - // report cache hit - JustMRStatistics::Instance().IncrementCacheHitsCounter(); + (*ws_setter)(std::pair( + nlohmann::json::array({"git tree", *subtree, repo_root}), true)); } } @@ -252,5 +248,6 @@ auto CreateCommitGitMap( fatal); }); }; - return AsyncMapConsumer(commit_to_git, jobs); + return AsyncMapConsumer>( + commit_to_git, jobs); } -- cgit v1.2.3