def operation(self):
        # ------- BEGIN Anomalies section -------
        anomalies_to_save = get_anomalies()
        save_anomalies(anomalies_to_save)
        # ------- END Anomalies section ---------

        # ------- BEGIN Stats section -----------
        current_time = datetime_now()
        statistic_summary = get_statistics()
        save_statistics(GLSettings.stats_collection_start_time, current_time,
                        statistic_summary)
        # ------- END Stats section -------------

        # Hourly Resets
        GLSettings.reset_hourly()

        log.debug("Saved stats and time updated, keys saved %d" %
                  len(statistic_summary.keys()))
Exemple #2
0
    def setUp(self):
        test_config.skipCase(self)
        self.test_reactor = task.Clock()

        jobs.base.test_reactor = self.test_reactor
        tempdict.test_reactor = self.test_reactor
        token.TokenList.reactor = self.test_reactor
        GLSessions.reactor = self.test_reactor

        init_glsettings_for_unit_tests()

        self.setUp_dummy()

        if self.initialize_test_database_using_archived_db:
            shutil.copy(
                os.path.join(TEST_DIR, 'db', 'empty', GLSettings.db_file_name),
                os.path.join(GLSettings.working_path, 'db',
                             GLSettings.db_file_name))
        else:
            yield db.init_db(use_single_lang=True)

        allow_unencrypted = self.encryption_scenario in ['PLAINTEXT', 'MIXED']

        yield update_node_setting('allow_unencrypted', allow_unencrypted)

        yield db.refresh_memory_variables()

        sup = ProcessSupervisor([], '127.0.0.1', 8082)
        GLSettings.state.process_supervisor = sup

        Alarm.reset()
        event.EventTrackQueue.clear()
        GLSettings.reset_hourly()

        GLSettings.submission_minimum_delay = 0

        self.internationalized_text = load_appdata(
        )['node']['whistleblowing_button']
Exemple #3
0
    def operation(self):
        # ------- BEGIN Anomalies section -------
        anomalies_to_save = get_anomalies()
        if anomalies_to_save:
            save_anomalies(anomalies_to_save)
            log.debug("Stored %d anomalies collected during the last hour",
                      len(anomalies_to_save))

        # ------- END Anomalies section ---------

        # ------- BEGIN Stats section -----------
        current_time = datetime_now()
        statistic_summary = get_statistics()
        if statistic_summary:
            save_statistics(GLSettings.stats_collection_start_time,
                            current_time, statistic_summary)
            log.debug("Stored statistics %s collected from %s to %s",
                      statistic_summary,
                      GLSettings.stats_collection_start_time, current_time)
        # ------- END Stats section -------------

        # Hourly Resets
        GLSettings.reset_hourly()