Exemplo n.º 1
0
 def send_stats(self):
     """Collect and send statistics"""
     try:
         stat_dict = return_stat_file_dict(STATS_CSV)
         if float(stat_dict['next_send']) < time.time():
             self.timer_stats = self.timer_stats + STATS_INTERVAL
             add_update_csv(STATS_CSV, 'next_send', self.timer_stats)
         else:
             self.timer_stats = float(stat_dict['next_send'])
     except Exception as msg:
         self.timer_stats = self.timer_stats + STATS_INTERVAL
         self.logger.exception(
             "Error: Could not read stats file. Regenerating. Message: "
             "{msg}".format(msg=msg))
         try:
             os.remove(STATS_CSV)
         except OSError:
             pass
         recreate_stat_file()
     try:
         send_anonymous_stats(self.start_time)
     except Exception as except_msg:
         self.logger.exception(
             "Error: Could not send statistics: {err}".format(
                 err=except_msg))
Exemplo n.º 2
0
    def send_stats(self):
        """Collect and send statistics"""
        # Check if stats file exists, recreate if not
        try:
            return_stat_file_dict(STATS_CSV)
        except Exception as except_msg:
            self.logger.exception(
                "Error reading stats file: {err}".format(err=except_msg))
            try:
                os.remove(STATS_CSV)
            except OSError:
                pass
            recreate_stat_file()

        # Send stats
        try:
            send_anonymous_stats(self.start_time)
        except Exception as except_msg:
            self.logger.exception(
                "Could not send statistics: {err}".format(err=except_msg))
Exemplo n.º 3
0
    def send_stats(self):
        """Collect and send statistics"""
        # Check if stats file exists, recreate if not
        try:
            return_stat_file_dict(STATS_CSV)
        except Exception as except_msg:
            self.logger.exception(
                "Error reading stats file: {err}".format(
                    err=except_msg))
            try:
                os.remove(STATS_CSV)
            except OSError:
                pass
            recreate_stat_file()

        # Send stats
        try:
            send_anonymous_stats(self.start_time)
        except Exception as except_msg:
            self.logger.exception(
                "Could not send statistics: {err}".format(
                    err=except_msg))