diff options
Diffstat (limited to 'buildscripts/burn_in_tags.py')
-rw-r--r-- | buildscripts/burn_in_tags.py | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/buildscripts/burn_in_tags.py b/buildscripts/burn_in_tags.py index d4e49681139..4cdcfe524ec 100644 --- a/buildscripts/burn_in_tags.py +++ b/buildscripts/burn_in_tags.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 """Generate burn in tests to run on certain build variants.""" from collections import namedtuple +import logging import os import sys from typing import Any, Dict, List @@ -24,6 +25,11 @@ from buildscripts.burn_in_tests import create_generate_tasks_config, create_test find_changed_tests, GenerateConfig, RepeatConfig, DEFAULT_REPO_LOCATIONS # pylint: enable=wrong-import-position +EXTERNAL_LOGGERS = { + "evergreen", + "git", + "urllib3", +} CONFIG_DIRECTORY = "generated_burn_in_tags_config" CONFIG_FILE = "burn_in_tags_gen.json" EVERGREEN_FILE = "etc/evergreen.yml" @@ -171,10 +177,27 @@ def burn_in(task_expansions: Dict[str, Any], evg_conf: EvergreenProjectConfig, write_file_to_dir(CONFIG_DIRECTORY, CONFIG_FILE, shrub_project.json()) +def _configure_logging(verbose: bool): + """ + Configure logging for the application. + + :param verbose: If True set log level to DEBUG. + """ + level = logging.DEBUG if verbose else logging.INFO + logging.basicConfig( + format="[%(asctime)s - %(name)s - %(levelname)s] %(message)s", + level=level, + stream=sys.stdout, + ) + for log_name in EXTERNAL_LOGGERS: + logging.getLogger(log_name).setLevel(logging.WARNING) + + @click.command() @click.option("--expansion-file", "expansion_file", required=True, help="Location of expansions file generated by evergreen.") -def main(expansion_file: str): +@click.option("--verbose", is_flag=True) +def main(expansion_file: str, verbose: bool): """ Run new or changed tests in repeated mode to validate their stability. @@ -184,6 +207,7 @@ def main(expansion_file: str): \f :param expansion_file: The expansion file containing the configuration params. """ + _configure_logging(verbose) evg_api = RetryingEvergreenApi.get_api(config_file=EVG_CONFIG_FILE) repos = [Repo(x) for x in DEFAULT_REPO_LOCATIONS if os.path.isdir(x)] expansions_file_data = read_config.read_config_file(expansion_file) |