summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Moody <daniel.moody@mongodb.com>2022-10-31 17:33:55 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-11-07 15:33:13 +0000
commit7f22f97737ba53a255900697dee09688e41451a7 (patch)
tree107d384afccd1a2b2a31703b57b978978533cfa6
parentbb65f34a5728db4f94efef7ced07ef2310e69eb8 (diff)
downloadmongo-7f22f97737ba53a255900697dee09688e41451a7.tar.gz
SERVER-70843 fix scons metrics reporting when scons cache is not in use.
(cherry picked from commit d0c05f39f0b73283bf909bdb2c6f0a0f55d223de)
-rw-r--r--buildscripts/scons_metrics/metrics.py3
-rw-r--r--buildscripts/scons_metrics/report.py15
2 files changed, 2 insertions, 16 deletions
diff --git a/buildscripts/scons_metrics/metrics.py b/buildscripts/scons_metrics/metrics.py
index 125204dc4ac..6e9949f770c 100644
--- a/buildscripts/scons_metrics/metrics.py
+++ b/buildscripts/scons_metrics/metrics.py
@@ -1,5 +1,6 @@
"""SCons metrics."""
import re
+import os
from typing import Optional, NamedTuple, List, Pattern, AnyStr
from buildscripts.util.cedar_report import CedarMetric, CedarTestReport
@@ -105,7 +106,7 @@ class SconsMetrics: # pylint: disable=too-many-instance-attributes
self.total_command_execution_time = self._parse_float(
TOTAL_COMMAND_EXECUTION_TIME_REGEX, self.raw_report)
- if cache_debug_log_file:
+ if os.path.exists(cache_debug_log_file):
with open(cache_debug_log_file, "r") as fh:
self.final_cache_hit_ratio = self._parse_float(CACHE_HIT_RATIO_REGEX, fh.read())
else:
diff --git a/buildscripts/scons_metrics/report.py b/buildscripts/scons_metrics/report.py
index cae5e5ef1d0..c016492c966 100644
--- a/buildscripts/scons_metrics/report.py
+++ b/buildscripts/scons_metrics/report.py
@@ -27,21 +27,6 @@ def main(scons_stdout_log_file: str, scons_cache_debug_log_file: str,
scons_cache_debug_log_file = os.path.abspath(scons_cache_debug_log_file)
cedar_report_file = os.path.abspath(cedar_report_file)
- # This is a special file which must be available to use scons cache in evergreen. Here
- # we are assuming that if this file is not present then this a static host which
- # can not use scons cache in evergreen so therefore we will disable colleting cache metrics.
- # Otherwise we assume the cache is available and if the cache log file is not found,
- # something is not right and we exit with failure.
- if not os.path.exists('/etc/mongodb-build-system-id'):
- print(
- "System is a static host and not connected to AWS cache dir. Skipping scons cache metrics."
- )
- scons_cache_debug_log_file = None
- else:
- if not os.path.exists(scons_cache_debug_log_file):
- print(f"Could not find SCons cache debug log file '{scons_cache_debug_log_file}'.")
- sys.exit(1)
-
if not os.path.exists(scons_stdout_log_file):
print(f"Could not find SCons stdout log file '{scons_stdout_log_file}'.")
sys.exit(1)