Beispiel #1
0
    def initialize(self, settings_location):
        settings_provider = SettingsProvider(location=settings_location,
                                             logger=self.__logger)

        self.__settings = settings_provider.load()

        self.setup_thread_pool()

        self.setup_services()
Beispiel #2
0
    def initialize():
        config = Config()
        log_distributor_builder = LogDistributorBuilder()
        default_log_distributor = log_distributor_builder.build_default()

        logger = Logger()
        logger.setup([default_log_distributor])

        App.__path_provider = PathProvider(logger=logger)

        config.pathes = App.__path_provider.load(load_default=True)

        App.__settings_provider = SettingsProvider(location=config.pathes[PathKeys.SETTINGS].location,
                                                   logger=logger)
        config.settings = App.__settings_provider.load()

        log_distributor_builder.setup(config.settings[SettingsKeys.logging][SettingsKeys.loggers])
        log_distributors = log_distributor_builder.build_all()

        logger.setup(log_distributors=log_distributors)

        delete_excess_files(
            config.pathes[PathKeys.GEN_OUT].location,
            config.settings[SettingsKeys.system][SettingsKeys.out_files_max],
            logger)

        delete_excess_files(
            config.pathes[PathKeys.LOG].location,
            config.settings[SettingsKeys.logging][SettingsKeys.logger_files_max],
            logger)

        App.__gen_settings_provider = SettingsProvider(location=config.pathes[PathKeys.GEN_SETTINGS].location,
                                                       logger=logger)
        config.gen_settings = App.__gen_settings_provider.load()

        App.__logger = logger
        #App.setup_thread_pool(config)

        #App.__data_collector = ReportDataCollector()
        #App.__data_collector.setup()

        App.__reporter = Reporter(App.__data_collector.data)

        #App.__batch_amount = config.gen_settings[GenSettingsKeys.portion_amount]

        return config, logger
Beispiel #3
0
    def initialize(self, data_collector, settings_location=""):
        self.__data_collector = data_collector
        self.reporter = Reporter(self.__data_collector.data)

        if settings_location != "":
            settings_provider = SettingsProvider(location=settings_location, logger=self.__logger)
            self.__settings = settings_provider.load()

        self.host = self.__settings[SettingsKeys.reporter][SettingsKeys.host]
        self.port = self.__settings[SettingsKeys.reporter][SettingsKeys.port]


        Handler = http.server.SimpleHTTPRequestHandler
        self.server = socketserver.TCPServer((self.host, int(self.port)), Handler)
        self.ip, self.port = self.server.server_address


        self.__setup_thread_pool()
Beispiel #4
0
    def initialize(self, settings_location):
        self.__settings = SettingsProvider(location=settings_location, logger=self.__logger).load()

        self.__setup_services()

        self.stop_event = Event()
        self.stop_event.set()
        self.stop_event.clear()

        self.sql_info_thread = TaskThread("sql_info_thread", None, self.__logger)
        self.sql_info_thread.setup(task=self.__update_sql_info_loop, events={"stop_all": self.stop_event})
Beispiel #5
0
    def finalize():
        stop_delay = SettingsProvider(
            location=Main.pathes[PathKeys.SETTINGS].location,
            logger=Main.logger).load()[SettingsKeys.system][
                SettingsKeys.manual_stop]
        if stop_delay > 0:
            time.sleep(stop_delay)

        Main.sender.stop()
        Main.consumer.stop()
        Main.report_sender.stop()
        Main.data_collector.stop()
Beispiel #6
0
 def setup(self, settings_location):
     settings_provider = SettingsProvider(location=settings_location)
     self.__loggers_settings = settings_provider.load()[
         SettingsKeys.logging][SettingsKeys.loggers]
Beispiel #7
0
    def initialize(self, settings_location):
        gen_settings_provider = SettingsProvider(location=settings_location,
                                                 logger=self.__logger)

        self.__settings = gen_settings_provider.load()