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/distdir_git_map.cpp | 34 ++++++++++++--------------- 1 file changed, 15 insertions(+), 19 deletions(-) (limited to 'src/other_tools/root_maps/distdir_git_map.cpp') diff --git a/src/other_tools/root_maps/distdir_git_map.cpp b/src/other_tools/root_maps/distdir_git_map.cpp index ef21b7cc..403247e4 100644 --- a/src/other_tools/root_maps/distdir_git_map.cpp +++ b/src/other_tools/root_maps/distdir_git_map.cpp @@ -99,12 +99,12 @@ auto CreateDistdirGitMap( } // subdir is ".", so no need to deal with the Git cache // set the workspace root - (*setter)(nlohmann::json::array( - {"git tree", - distdir_tree_id, - JustMR::Utils::GetGitCacheRoot().string()})); - // report cache hit - JustMRStatistics::Instance().IncrementCacheHitsCounter(); + (*setter)(std::pair( + nlohmann::json::array( + {"git tree", + distdir_tree_id, + JustMR::Utils::GetGitCacheRoot().string()}), + true)); }, [logger, target_path = JustMR::Utils::GetGitCacheRoot()]( auto const& msg, bool fatal) { @@ -117,9 +117,6 @@ auto CreateDistdirGitMap( }); } else { - // start work reporting - JustMRProgress::Instance().TaskTracker().Start(key.origin); - JustMRStatistics::Instance().IncrementQueuedCounter(); // fetch the gathered distdir repos into CAS content_cas_map->ConsumeAfterKeysReady( ts, @@ -180,15 +177,13 @@ auto CreateDistdirGitMap( return; } // set the workspace root - (*setter)(nlohmann::json::array( - {"git tree", - distdir_tree_id, - JustMR::Utils::GetGitCacheRoot().string()})); - // report work done - JustMRProgress::Instance().TaskTracker().Stop( - origin); - JustMRStatistics::Instance() - .IncrementExecutedCounter(); + (*setter)( + std::pair(nlohmann::json::array( + {"git tree", + distdir_tree_id, + JustMR::Utils::GetGitCacheRoot() + .string()}), + false)); }, [logger, target_path = tmp_dir->GetPath()]( auto const& msg, bool fatal) { @@ -209,5 +204,6 @@ auto CreateDistdirGitMap( }); } }; - return AsyncMapConsumer(distdir_to_git, jobs); + return AsyncMapConsumer>( + distdir_to_git, jobs); } -- cgit v1.2.3