From 926085650510abe30f5800ea38676649784a00eb Mon Sep 17 00:00:00 2001 From: Chavithra Date: Fri, 25 Mar 2022 14:46:41 +0100 Subject: [PATCH] Logging : Disable Log Collection on CI (#1553) * Logging : workflows put env in alphabetic order * Logging : disable log_collection on workflows * Logging : some cleaning * Logging : catch join exception --- .github/workflows/mac.yml | 7 ++++--- .github/workflows/test.yml | 7 ++++--- .github/workflows/windows.yml | 7 ++++--- gamestonk_terminal/feature_flags.py | 3 --- gamestonk_terminal/log/generation/expired_files.py | 2 +- .../log/generation/path_tracking_file_handler.py | 13 ++++++++----- 6 files changed, 21 insertions(+), 18 deletions(-) diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index a2221380d13..292c73c6545 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -1,9 +1,10 @@ name: Mac OS X Full Clean Build with ML env: - PIP_DEFAULT_TIMEOUT: 100 - GTFF_USE_PROMPT_TOOLKIT: false - GTFF_USE_ION: false GTFF_ENABLE_QUICK_EXIT: true + GTFF_LOG_COLLECTION: false + GTFF_USE_ION: false + GTFF_USE_PROMPT_TOOLKIT: false + PIP_DEFAULT_TIMEOUT: 100 PYTHONNOUSERSITE: 1 on: push: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3c826ab6ef5..549846912b4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,9 +1,10 @@ name: Tests env: - PIP_DEFAULT_TIMEOUT: 100 - GTFF_USE_PROMPT_TOOLKIT: false - GTFF_USE_ION: false GTFF_ENABLE_QUICK_EXIT: true + GTFF_LOG_COLLECTION: false + GTFF_USE_ION: false + GTFF_USE_PROMPT_TOOLKIT: false + PIP_DEFAULT_TIMEOUT: 100 on: [pull_request, push] jobs: linting: diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 3cf8f68f1b6..4ce2375c19f 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -1,9 +1,10 @@ name: Windows 10 Full Clean Build with ML env: - PIP_DEFAULT_TIMEOUT: 100 - GTFF_USE_PROMPT_TOOLKIT: false - GTFF_USE_ION: false GTFF_ENABLE_QUICK_EXIT: true + GTFF_LOG_COLLECTION: false + GTFF_USE_ION: false + GTFF_USE_PROMPT_TOOLKIT: false + PIP_DEFAULT_TIMEOUT: 100 PYTHONNOUSERSITE: 1 on: push: diff --git a/gamestonk_terminal/feature_flags.py b/gamestonk_terminal/feature_flags.py index c6330752c34..80cca187b42 100644 --- a/gamestonk_terminal/feature_flags.py +++ b/gamestonk_terminal/feature_flags.py @@ -67,8 +67,5 @@ ENABLE_CHECK_API = strtobool(os.getenv("GTFF_ENABLE_CHECK_API", "True")) # Send logs to data lake LOG_COLLECTION = strtobool(os.getenv("GTFF_LOG_COLLECTION", "False")) -# Send only file size -ONLY_SEND_FILE_SIZE = strtobool(os.getenv("GTFF_ONLY_SEND_FILE_SIZE", "False")) - # Provide export folder path. If empty that means default. EXPORT_FOLDER_PATH = os.getenv("GTFF_EXPORT_FOLDER_PATH", "") diff --git a/gamestonk_terminal/log/generation/expired_files.py b/gamestonk_terminal/log/generation/expired_files.py index 9306694dc49..7da9870a055 100644 --- a/gamestonk_terminal/log/generation/expired_files.py +++ b/gamestonk_terminal/log/generation/expired_files.py @@ -14,7 +14,7 @@ def get_timestamp_from_x_days(x: int): return timestamp_from_x_days -def get_expired_files(directory: Path, before_timestamp: float): +def get_expired_file_list(directory: Path, before_timestamp: float): expired_files = list() if directory.exists and directory.is_dir(): for file in directory.iterdir(): diff --git a/gamestonk_terminal/log/generation/path_tracking_file_handler.py b/gamestonk_terminal/log/generation/path_tracking_file_handler.py index 8482f19bc95..a3014102290 100644 --- a/gamestonk_terminal/log/generation/path_tracking_file_handler.py +++ b/gamestonk_terminal/log/generation/path_tracking_file_handler.py @@ -13,7 +13,7 @@ from gamestonk_terminal.log.collection.log_sender import LogSender from gamestonk_terminal.log.collection.logging_clock import LoggingClock, Precision from gamestonk_terminal.log.generation.directories import get_log_dir, get_log_sub_dir from gamestonk_terminal.log.generation.expired_files import ( - get_expired_files, + get_expired_file_list, get_timestamp_from_x_days, remove_file_list, ) @@ -56,11 +56,11 @@ class PathTrackingFileHandler(TimedRotatingFileHandler): archives_directory = get_log_sub_dir(name=ARCHIVES_FOLDER_NAME) tmp_directory = get_log_sub_dir(name=TMP_FOLDER_NAME) - expired_archives_file_list = get_expired_files( + expired_archives_file_list = get_expired_file_list( directory=archives_directory, before_timestamp=before_timestamp, ) - expired_tmp_file_list = get_expired_files( + expired_tmp_file_list = get_expired_file_list( directory=tmp_directory, before_timestamp=before_timestamp, ) @@ -107,7 +107,7 @@ class PathTrackingFileHandler(TimedRotatingFileHandler): log_sender = self.__log_sender log_directory = get_log_dir() - expired_log_file_list = get_expired_files( + expired_log_file_list = get_expired_file_list( directory=log_directory, before_timestamp=before_timestamp, ) @@ -174,4 +174,7 @@ class PathTrackingFileHandler(TimedRotatingFileHandler): log_sender = self.__log_sender closed_log_path = self.baseFilename log_sender.send_path(path=Path(closed_log_path), last=True) - log_sender.join() + try: + log_sender.join() + except Exception: + pass