BackupManager¶
-
class
utils.
BackupManager
¶ Bases:
object
This class manages all thing relating to backups.
Methods Summary
create
(messurement, start, end)Create a new backup locally. delete_backup
(filename)Delete specified backup files. get_backups
()List backup files which exist locally. get_backups_folder
()Get the path to the local backup folder. Methods Documentation
-
create
(messurement: str, start: str = None, end: str = None) → str¶ Create a new backup locally.
Parameters: - messurement – The messurement type i.e. ‘readings’ or ‘logs’.
- start – Datetime start of backup period (default: 1 hour ago).
- end – Datetime end of backup period (default: Now).
Returns: Saved file name
Raises: LookupError if no data to backup
-
delete_backup
(filename: str)¶ Delete specified backup files.
Parameters: filename – The name of the backup file to delete. This cannont be a path and must be in the backups folder. Raises: FileNotFoundError
-
get_backups
() → List[Dict]¶ List backup files which exist locally.
Returns: List of dictionarys containing filename, stem, dataset, start and end.
-
get_backups_folder
() → unipath.path.Path¶ Get the path to the local backup folder. Automatically creates folder if does not exist.
Returns: List of Paths Return type: path
-