コード例 #1
0
 def doPrepareListBackups(self, *args, **kwargs):
     from storage import backup_rebuilder
     if backup_control.HasRunningBackup():
         # if some backups are running right now no need to rebuild something - too much use of CPU
         backup_rebuilder.RemoveAllBackupsToWork()
         lg.out(6, 'backup_monitor.doPrepareListBackups skip all rebuilds')
         self.automat('list-backups-done')
         return
     # take remote and local backups and get union from it
     allBackupIDs = set(
         list(backup_matrix.local_files().keys()) +
         list(backup_matrix.remote_files().keys()))
     # take only backups from data base
     allBackupIDs.intersection_update(backup_fs.ListAllBackupIDs())
     # remove running backups
     allBackupIDs.difference_update(backup_control.ListRunningBackups())
     # sort it in reverse order - newer backups should be repaired first
     allBackupIDs = misc.sorted_backup_ids(list(allBackupIDs), True)
     # add backups to the queue
     backup_rebuilder.AddBackupsToWork(allBackupIDs)
     lg.out(
         6, 'backup_monitor.doPrepareListBackups %d items:' %
         len(allBackupIDs))
     lg.out(6, '    %s' % allBackupIDs)
     self.automat('list-backups-done', allBackupIDs)
コード例 #2
0
def run_sheduled_update():
    global _UpdatingByUser
    global _UpdatingInProgress
    lg.out(6, 'os_windows_update.run_sheduled_update')
    if _UpdatingInProgress:
        lg.out(6, '  update is in progress, finish.')
        return
    if settings.getUpdatesMode() == settings.getUpdatesModeValues()[2]:
        lg.out(6, '  update mode is %s, finish.' % settings.getUpdatesMode())
        return
    from storage import backup_control
    if backup_control.HasRunningBackup():
        lg.out(6, '  some backups are running at the moment, finish.')
        return

    _UpdatingByUser = False
    reactor.callLater(0, step0)

    # check or start the update
    d = read_shedule_dict()
    d['lasttime'] = str(time.time())
    write_shedule_dict(d)
    loop()