def clear_cache(self):
        try:
            print("ExternalTempDataDiskBuffer going to terminate...")
            self.terminate()
            # restart
            print("ExternalTempDataDiskBuffer going to reset...")
            # self.reset()
            # print("ExternalTempDataDiskBuffer going to force clear...")
            TempDBInterface.force_clear(self._file_name, self._file_dir)
            print("ExternalTempDataDiskBuffer going to remove power_save_db...")
            self.remove_power_save_db()
            #self.start_input_output_cycle()
            print("clear cache completed: "+self._file_name)

            print("ExternalTempDataDiskBuffer going to reset...")
            self.reset(clear_input_buff=False)
        except Exception as ex:
            print("ExternalTempDataDiskBuffer error in clear cache: "+self._file_name)
            print(ex)
            ErrorLogger.log_error("ExternalTempDataDiskBuffer.clear_cache_and_restart() ", ex, self._file_name)
 def clear_trash(self):  # run with a thread
     while not self.stop_event.is_set():
         with self.db_trash_lock:
             removed_list = []
             trash_len = len(self.db_trash_list)
             if trash_len > 0:
                 for item in self.db_trash_list:
                     if TempDBInterface.force_clear(item):
                         #print("removed trash:", item)
                         removed_list.append(item)
                 for removed_item in removed_list:
                     self.db_trash_list.remove(removed_item)
                 CsvLogger.log_to_file("job_finished", [(x, str(datetime.datetime.now())) for x in removed_list], get_task_backup_dir())
                 removed_list.clear()
         time.sleep(2)
    def clear_cache(self):
        try:
            print("ExternalTempDataDiskBuffer going to terminate...")
            self.terminate()
            # restart
            print("ExternalTempDataDiskBuffer going to reset...")
            # self.reset()
            # print("ExternalTempDataDiskBuffer going to force clear...")
            TempDBInterface.force_clear(self._file_name, self._file_dir)
            print(
                "ExternalTempDataDiskBuffer going to remove power_save_db...")
            self.remove_power_save_db()
            #self.start_input_output_cycle()
            print("clear cache completed: " + self._file_name)

            print("ExternalTempDataDiskBuffer going to reset...")
            self.reset(clear_input_buff=False)
        except Exception as ex:
            print("ExternalTempDataDiskBuffer error in clear cache: " +
                  self._file_name)
            print(ex)
            ErrorLogger.log_error(
                "ExternalTempDataDiskBuffer.clear_cache_and_restart() ", ex,
                self._file_name)
Example #4
0
 def clear_trash(self):  # run with a thread
     while not self.stop_event.is_set():
         with self.db_trash_lock:
             removed_list = []
             trash_len = len(self.db_trash_list)
             if trash_len > 0:
                 for item in self.db_trash_list:
                     if TempDBInterface.force_clear(item):
                         #print("removed trash:", item)
                         removed_list.append(item)
                 for removed_item in removed_list:
                     self.db_trash_list.remove(removed_item)
                 CsvLogger.log_to_file("job_finished",
                                       [(x, str(datetime.datetime.now()))
                                        for x in removed_list],
                                       get_task_backup_dir())
                 removed_list.clear()
         time.sleep(2)