本文整理汇总了Python中lib.db.DB.fs_saved_commit方法的典型用法代码示例。如果您正苦于以下问题:Python DB.fs_saved_commit方法的具体用法?Python DB.fs_saved_commit怎么用?Python DB.fs_saved_commit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.db.DB
的用法示例。
在下文中一共展示了DB.fs_saved_commit方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Run
# 需要导入模块: from lib.db import DB [as 别名]
# 或者: from lib.db.DB import fs_saved_commit [as 别名]
#.........这里部分代码省略.........
self.backup_folder = os.path.join(self.backup.name, self.start_time.strftime(const.DateTimeFormat) + " " + self.type)
if not self.dry_run:
self.run_id = self.db.start_run(self.backup.name, self.backup.store, self.type, self.start_time)
msg = _("Backup {server}/{backup}/{type} beginning").format(
server=utils.get_hostname(),
backup=self.backup.name,
type=self.type)
if self.dry_run:
msg += _(" (Dry Run)")
log.info(msg)
self.db.save_message(msg)
if self.orig_type != self.type:
# The backup type was switched
self.db.save_message(_("NOTE: Backup type switched to {newtype} from {oldtype}").format(
newtype=self.type, oldtype=self.orig_type))
# After here we have a run set up in the database, and can begin logging errors.
try:
# Check that if ENCRYPTION is enabled, that there is a password defined.
if self.backup.encrypt and not self.config.data_passphrase:
raise Exception("Backup encryption required, but no passphrase has been configured. Backup cancelled.")
self.prepare_store()
# Prepare output/destinations/encryption
self.prepare_output()
try:
# Now we actually DO the backup, for each listed folder
for folder in self.backup.include_folders:
self.recursive_backup_folder(folder)
log.debug("Committing saved fs entries...")
self.db.fs_saved_commit()
log.debug("Closing...")
self.close_output(success=True)
#raise Exception("Test Exception")
except Exception as e:
log.warn("Exception during backup:", str(e))
# We are going to fail. But we need to try and close
# whatever we can. Closing may fail, but in this case
# we ignore that error.
try:
self.close_output(success=False)
except:
pass
raise e
if self.backup.verify and not self.dry_run:
log.info("Starting verify phase")
msg = _("Backup {server}/{backup}/{type} verification starting").format(
server=utils.get_hostname(),
backup=self.backup.name,
type=self.type)
self.db.save_message(msg)
v = Verify(self.backup.name, self.start_time)
v.run()
msg = _("Backup {server}/{backup}/{type} verification succeeded").format(
server=utils.get_hostname(),
backup=self.backup.name,
type=self.type)
self.db.save_message(msg)
# self.do_verify()