<commit_before>"""
Collector service provides methods for collection of test runtime results results and storing results

2017 - samuels(c)
"""
import time

from logger import server_logger


class Collector:
    def __init__(self, test_stats, stop_event):
        self.logger = server_logger.StatsLogger('__Collector__').logger
        self.test_stats = test_stats
        self.stop_event = stop_event

    def run(self):
        while not self.stop_event.is_set():
            self.logger.info("{0}".format("############################"))
            self.logger.info("{0}".format("#### Test Runtime Stats ####"))
            self.logger.info("{0}".format("############################"))
            self.logger.info("{0:>10}".format("Total file operations executed {0}".format(self.test_stats['total'])))
            self.logger.info("{0:>10}".format("Total file operations succeeded {0}"
                                          .format(self.test_stats['success']['total'])))
            self.logger.info("{0:>10}".format("Total file operations failed {0}"
                                          .format(self.test_stats['failed']['total'])))
            self.logger.info("{0}".format("=== Successful operations stats ==="))
            for k, v in self.test_stats['success'].items():
                self.logger.info("{0:>10}".format("{0}: {1}".format(k, v)))
            self.logger.info("{0}".format("=== Failed operations stats ==="))
            for k, v in self.test_stats['failed'].items():
                self.logger.info("{0:>10}".format("{0}: {1}".format(k, v)))
            time.sleep(60)<commit_msg>Fix: Test statistics print formatting<commit_after>"""
Collector service provides methods for collection of test runtime results results and storing results

2017 - samuels(c)
"""
import time

from logger import server_logger


class Collector:
    def __init__(self, test_stats, stop_event):
        self.logger = server_logger.StatsLogger('__Collector__').logger
        self.test_stats = test_stats
        self.stop_event = stop_event

    def run(self):
        time.sleep(60)
        while not self.stop_event.is_set():
            self.logger.info("{0}".format("############################"))
            self.logger.info("{0}".format("#### Test Runtime Stats ####"))
            self.logger.info("{0}".format("############################"))
            self.logger.info("{0}".format("Total file operations executed {0}".format(self.test_stats['total'])))
            self.logger.info("{0}".format("Total file operations succeeded {0}"
                                          .format(self.test_stats['success']['total'])))
            self.logger.info("{0}".format("Total file operations failed {0}"
                                          .format(self.test_stats['failed']['total'])))
            self.logger.info("{0}".format("=== Successful operations stats ==="))
            for k, v in self.test_stats['success'].items():
                self.logger.info("{0}".format("{0}: {1}".format(k, v)))
            self.logger.info("{0}".format("=== Failed operations stats ==="))
            for k, v in self.test_stats['failed'].items():
                self.logger.info("{0}".format("{0}: {1}".format(k, v)))
            time.sleep(60)
{'fraction_non_alphanumeric': 0.20189660446619762, 'fraction_numerical': 0.017742428877332517, 'mean_word_length': 2.661814109742441, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '309508', 'n_tokens_mistral': 918, 'n_tokens_neox': 893, 'n_words': 180}