borgend/backup.py

changeset 116
4a56dda09745
parent 115
df0de44d2c4b
child 119
e5f29271089d
equal deleted inserted replaced
115:df0de44d2c4b 116:4a56dda09745
269 self.current_operation=None 269 self.current_operation=None
270 self.scheduled_operation=None 270 self.scheduled_operation=None
271 self.previous_operation_of_type={} 271 self.previous_operation_of_type={}
272 self.state=State.INACTIVE 272 self.state=State.INACTIVE
273 self.timeclass=DreamTime 273 self.timeclass=DreamTime
274 self.start_time=self.timeclass.now()
274 275
275 self.__decode_config(cfg) 276 self.__decode_config(cfg)
276 277
277 super().__init__(target = self.__main_thread, name = self.backup_name) 278 super().__init__(target = self.__main_thread, name = self.backup_name)
278 self.daemon=True 279 self.daemon=True
515 current=self.current_operation 516 current=self.current_operation
516 517
517 # Wait for main logger thread to terminate, or for us to be terminated 518 # Wait for main logger thread to terminate, or for us to be terminated
518 while not self._terminate_or_pause() and self.thread_res.is_alive(): 519 while not self._terminate_or_pause() and self.thread_res.is_alive():
519 self._cond.release() 520 self._cond.release()
521 # Maybe wait for borg instead?
520 self.thread_res.join(JOIN_TIMEOUT) 522 self.thread_res.join(JOIN_TIMEOUT)
521 self._cond.acquire() 523 self._cond.acquire()
522 524
523 # If terminate or pause has been signalled, let outer termination handler 525 # If terminate or pause has been signalled, let outer termination handler
524 # take care of things (Within this Backup class, it would be cleanest 526 # take care of things (Within this Backup class, it would be cleanest
644 646
645 prune=self.__next_operation_type(Operation.PRUNE, 647 prune=self.__next_operation_type(Operation.PRUNE,
646 self.prune_interval, 648 self.prune_interval,
647 important=False, 649 important=False,
648 initial_reason=None); 650 initial_reason=None);
651
652 if prune:
653 self.logger.debug("prune scheduled at %s " % prune.start_time.isoformat())
654 else:
655 self.logger.debug("no prune scheduled")
649 656
650 if not prune: 657 if not prune:
651 return create 658 return create
652 elif not create: 659 elif not create:
653 return prune 660 return prune
693 return None 700 return None
694 else: 701 else:
695 if important: 702 if important:
696 tm=MonotonicTime.now() 703 tm=MonotonicTime.now()
697 else: 704 else:
698 tm=self.timeclass.after(standard_interval) 705 tm=self.timeclass.after_other(self.start_time, standard_interval)
699 if initial_reason: 706 if initial_reason:
700 return Operation(optype, tm, reason=initial_reason) 707 return Operation(optype, tm, reason=initial_reason)
701 else: 708 else:
702 return Operation(optype, tm) 709 return Operation(optype, tm)
703 else: 710 else:

mercurial