diff options
author | Richard Samuels <richard.l.samuels@gmail.com> | 2022-02-10 18:04:43 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-02-10 18:49:44 +0000 |
commit | 02f6b67f4ee88bad152c8c6af5dea51b96e90804 (patch) | |
tree | 2708532f5efad30b071bebc7ffc2bcd0128305c6 /buildscripts | |
parent | 724d7f8cd512d3afde931d3d34220e7eb05e5a2d (diff) | |
download | mongo-02f6b67f4ee88bad152c8c6af5dea51b96e90804.tar.gz |
SERVER-63342 Reduce size of generated task configuration
Diffstat (limited to 'buildscripts')
-rw-r--r-- | buildscripts/evergreen_gen_build_variant.py | 11 | ||||
-rw-r--r-- | buildscripts/selected_tests.py | 11 | ||||
-rw-r--r-- | buildscripts/task_generation/task_types/fuzzer_tasks.py | 5 | ||||
-rw-r--r-- | buildscripts/task_generation/task_types/resmoke_tasks.py | 5 |
4 files changed, 28 insertions, 4 deletions
diff --git a/buildscripts/evergreen_gen_build_variant.py b/buildscripts/evergreen_gen_build_variant.py index 758e2f2ab0b..bac61f8156b 100644 --- a/buildscripts/evergreen_gen_build_variant.py +++ b/buildscripts/evergreen_gen_build_variant.py @@ -4,6 +4,8 @@ from concurrent.futures import ThreadPoolExecutor as Executor from datetime import datetime, timedelta from time import perf_counter from typing import Optional, Any, Set, Tuple +import hashlib +import os import click import inject @@ -121,7 +123,11 @@ class EvgExpansions(BaseModel): def config_location(self) -> str: """Location where generated configuration is stored.""" generated_task_name = remove_gen_suffix(self.task_name) - return f"{self.build_variant}/{self.revision}/generate_tasks/{generated_task_name}_gen-{self.build_id}.tgz" + file = f"{self.build_variant}/{self.revision}/generate_tasks/{generated_task_name}_gen-{self.build_id}" + # hash 'file' to shorten the file path dramatically + sha1 = hashlib.sha1() + sha1.update(file.encode('utf-8')) + return f"gtcl/{sha1.hexdigest()}.tgz" def translate_run_var(run_var: str, build_variant: Variant) -> Any: @@ -280,6 +286,9 @@ class GenerateBuildVariantOrchestrator: generated_config = builder.build(output_file) generated_config.write_all_to_dir(self.gen_task_options.generated_config_dir) + with open('gtcl_update_expansions.yml', "w+") as fh: + fh.write(f"gtcl: {self.evg_expansions.config_location()}") + # pylint: disable=too-many-locals def generate_build_variant(self, builder: EvgConfigBuilder, build_variant_name: str) -> EvgConfigBuilder: diff --git a/buildscripts/selected_tests.py b/buildscripts/selected_tests.py index b1df4686e22..5ffbe1284ab 100644 --- a/buildscripts/selected_tests.py +++ b/buildscripts/selected_tests.py @@ -3,6 +3,7 @@ import os import re import sys +import hashlib from datetime import datetime, timedelta from functools import partial from typing import Any, Dict, List, Set, Optional @@ -144,7 +145,11 @@ class EvgExpansions(BaseModel): def get_config_location(self) -> str: """Get the location the generated configuration will be stored.""" - return f"{self.build_variant}/{self.revision}/generate_tasks/{self.task_name}-{self.build_id}.tgz" + file = f"{self.build_variant}/{self.revision}/generate_tasks/{self.task_name}-{self.build_id}" + # hash 'file' to shorten the file path dramatically + sha1 = hashlib.sha1() + sha1.update(file.encode('utf-8')) + return f"gtcl/{sha1.hexdigest()}.tgz" class TaskConfigService: @@ -426,6 +431,10 @@ class SelectedTestsOrchestrator: generated_config = self.generate_version(changed_files) generated_config.write_all_to_dir(SELECTED_TESTS_CONFIG_DIR) + with open(os.path.join(SELECTED_TESTS_CONFIG_DIR, '..', + 'gtcl_update_expansions.yml')) as fh: + fh.write(f"gtcl: {self.evg_expansions.get_config_location()}") + def generate_version(self, changed_files: Set[str]) -> GeneratedConfiguration: """ Generate selected tests configuration for the given file changes. diff --git a/buildscripts/task_generation/task_types/fuzzer_tasks.py b/buildscripts/task_generation/task_types/fuzzer_tasks.py index 7e6294c9a75..039dee97d67 100644 --- a/buildscripts/task_generation/task_types/fuzzer_tasks.py +++ b/buildscripts/task_generation/task_types/fuzzer_tasks.py @@ -123,7 +123,10 @@ class FuzzerGenTaskService: "require_multiversion_setup": params.require_multiversion_setup, "timeout_secs": params.timeout_secs, "task": params.task_name, - "gen_task_config_location": params.config_location, + # This expansion's name was shortened to reduce the overall size of + # the generated configuration file + # gtcl = gen_task_config_location + "gtcl": params.config_location, "suite": params.suite, } # yapf: disable diff --git a/buildscripts/task_generation/task_types/resmoke_tasks.py b/buildscripts/task_generation/task_types/resmoke_tasks.py index 24710ffd88e..5fb4fed6e08 100644 --- a/buildscripts/task_generation/task_types/resmoke_tasks.py +++ b/buildscripts/task_generation/task_types/resmoke_tasks.py @@ -211,7 +211,10 @@ class ResmokeGenTaskService: } if params.config_location is not None: - variables["gen_task_config_location"] = params.config_location + # This expansion's name was shortened to reduce the overall size of + # the generated configuration file + # gtcl = gen_task_config_location + variables["gtcl"] = params.config_location if params.resmoke_jobs_max: variables["resmoke_jobs_max"] = params.resmoke_jobs_max |