def check_action(self): params = BorgCheckThread.prepare(self.profile()) if params['ok']: thread = BorgCheckThread(params['cmd'], params, parent=self) thread.updated.connect(self._set_status) thread.result.connect(self.check_result) self._toggle_all_buttons(False) thread.start()
def post_backup_tasks(self, profile_id): """ Pruning and checking after successful backup. """ profile = BackupProfileModel.get(id=profile_id) logger.info('Doing post-backup jobs for %s', profile.name) if profile.prune_on: msg = BorgPruneThread.prepare(profile) if msg['ok']: prune_thread = BorgPruneThread(msg['cmd'], msg) prune_thread.start() prune_thread.wait() # Refresh snapshots msg = BorgListThread.prepare(profile) if msg['ok']: list_thread = BorgListThread(msg['cmd'], msg) list_thread.start() list_thread.wait() validation_cutoff = date.today() - timedelta(days=7 * profile.validation_weeks) recent_validations = EventLogModel.select().where( (EventLogModel.subcommand == 'check') & (EventLogModel.start_time > validation_cutoff) & (EventLogModel.repo_url == profile.repo.url)).count() if profile.validation_on and recent_validations == 0: msg = BorgCheckThread.prepare(profile) if msg['ok']: check_thread = BorgCheckThread(msg['cmd'], msg) check_thread.start() check_thread.wait() logger.info('Finished background task for profile %s', profile.name)
def check_action(self): params = BorgCheckThread.prepare(self.profile()) if not params['ok']: self._set_status(params['message']) return # Conditions are met (borg binary available, etc) row_selected = self.archiveTable.selectionModel().selectedRows() if row_selected: archive_cell = self.archiveTable.item(row_selected[0].row(), 4) if archive_cell: archive_name = archive_cell.text() params['cmd'][-1] += f'::{archive_name}' thread = BorgCheckThread(params['cmd'], params, parent=self.app) thread.updated.connect(self._set_status) thread.result.connect(self.check_result) self._toggle_all_buttons(False) thread.start()