diff options
author | David Bradford <david.bradford@mongodb.com> | 2021-12-16 11:22:55 -0500 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-12-16 22:27:28 +0000 |
commit | 00b7518783c6a576c0996fc27f0bb85f13c78fc3 (patch) | |
tree | 782809c063f8b43de15e4c72747c9d0ddbac3eac /buildscripts/task_generation | |
parent | 7cb100e649c4e429719b07c9419a0b254ece3b79 (diff) | |
download | mongo-00b7518783c6a576c0996fc27f0bb85f13c78fc3.tar.gz |
SERVER-62097: Generated tasks should inherit timeouts specified by build variant
Diffstat (limited to 'buildscripts/task_generation')
-rw-r--r-- | buildscripts/task_generation/task_types/gentask_options.py | 10 | ||||
-rw-r--r-- | buildscripts/task_generation/task_types/resmoke_tasks.py | 9 | ||||
-rw-r--r-- | buildscripts/task_generation/timeout.py | 6 |
3 files changed, 21 insertions, 4 deletions
diff --git a/buildscripts/task_generation/task_types/gentask_options.py b/buildscripts/task_generation/task_types/gentask_options.py index b78a7974979..d9616abfe96 100644 --- a/buildscripts/task_generation/task_types/gentask_options.py +++ b/buildscripts/task_generation/task_types/gentask_options.py @@ -2,6 +2,8 @@ import os from typing import NamedTuple, Optional, List +from buildscripts.patch_builds.task_generation import TimeoutInfo + class GenTaskOptions(NamedTuple): """ @@ -18,6 +20,8 @@ class GenTaskOptions(NamedTuple): is_patch: bool generated_config_dir: str use_default_timeouts: bool + timeout_secs: Optional[int] + exec_timeout_secs: Optional[int] def suite_location(self, suite_name: str) -> str: """ @@ -39,3 +43,9 @@ class GenTaskOptions(NamedTuple): # here, just use the forward slash; otherwise the path separator will be treated as # the escape character on Windows. return "/".join([self.generated_config_dir, base_file]) + + def build_defualt_timeout(self) -> TimeoutInfo: + """Generate a timeout command that can be used if historic timing info is missing.""" + if self.timeout_secs is not None or self.exec_timeout_secs is not None: + return TimeoutInfo.overridden(self.exec_timeout_secs, self.timeout_secs) + return TimeoutInfo.default_timeout() diff --git a/buildscripts/task_generation/task_types/resmoke_tasks.py b/buildscripts/task_generation/task_types/resmoke_tasks.py index 513d6da8c13..24710ffd88e 100644 --- a/buildscripts/task_generation/task_types/resmoke_tasks.py +++ b/buildscripts/task_generation/task_types/resmoke_tasks.py @@ -137,9 +137,12 @@ class ResmokeGenTaskService: suite_file=suite.suite_name, task_name=suite.task_name, params=params) - timeout_info = timeout_est.generate_timeout_cmd(self.gen_task_options.is_patch, - params.repeat_suites, - self.gen_task_options.use_default_timeouts) + if timeout_est.is_specified(): + timeout_info = timeout_est.generate_timeout_cmd( + self.gen_task_options.is_patch, params.repeat_suites, + self.gen_task_options.use_default_timeouts) + else: + timeout_info = self.gen_task_options.build_defualt_timeout() commands = [ timeout_info.cmd, diff --git a/buildscripts/task_generation/timeout.py b/buildscripts/task_generation/timeout.py index 67db6568d65..0143cd6e8b1 100644 --- a/buildscripts/task_generation/timeout.py +++ b/buildscripts/task_generation/timeout.py @@ -43,6 +43,10 @@ class TimeoutEstimate(NamedTuple): """Create an instance with no estimation data.""" return cls(max_test_runtime=None, expected_task_runtime=None) + def is_specified(self) -> bool: + """Determine if any specific timeout value has been specified.""" + return self.max_test_runtime is not None or self.expected_task_runtime is not None + def calculate_test_timeout(self, repeat_factor: int) -> Optional[int]: """ Calculate the timeout to use for tests. @@ -84,7 +88,7 @@ class TimeoutEstimate(NamedTuple): :return: Timeout info for the task. """ - if (self.max_test_runtime is None and self.expected_task_runtime is None) or use_default: + if not self.is_specified or use_default: return TimeoutInfo.default_timeout() test_timeout = self.calculate_test_timeout(repeat_factor) |