Base abstract Backup class for all backends.
aiida.manage.backup.backup_base.
AbstractBackup
Bases: abc.ABC
abc.ABC
This class handles the backup of the AiiDA repository that is referenced by the current AiiDA database. The backup will start from the given backup timestamp (oldest_object_backedup) or the date of the oldest node/workflow object found and it will periodically backup (in periods of periodicity days) until the ending date of the backup specified by end_date_of_backup or days_to_backup.
BACKUP_DIR_KEY
BACKUP_LENGTH_THRESHOLD_KEY
DAYS_TO_BACKUP_KEY
END_DATE_OF_BACKUP_KEY
OLDEST_OBJECT_BK_KEY
PERIODICITY_KEY
__abstractmethods__
__dict__
__init__
Initialize self. See help(type(self)) for accurate signature.
__module__
__weakref__
list of weak references to the object (if defined)
_abc_impl
_additional_back_time_mins
_backup_dir
_backup_length_threshold
_backup_needed_files
Perform backup of a minimum-set of files
_days_to_backup
_dictionarize_backup_info
This dictionarises the backup information and returns the dictionary.
_end_date_of_backup
_extract_parent_dirs
This method extracts the parent directories of the givenDir and populates the parent_dir_set.
_find_files_to_backup
Query the database for nodes that were created after the the start of the last backup. Return a query set.
_get_query_set_iterator
Get query set iterator
_get_query_set_length
Get query set length
_get_query_sets
Get query set
_get_repository_path
_get_source_directory
Get source directory of item :param self: :return:
_ignore_backup_dir_existence_check
_internal_end_date_of_backup
_oldest_object_bk
_periodicity
_query_first_node
Query first node
_read_backup_info_from_dict
This method reads the backup information from the given dictionary and sets the needed class variables.
_read_backup_info_from_file
This method reads the backup information from the given file and passes the dictionary to the method responsible for the initialization of the needed class variables.
_store_backup_info
This method writes the backup variables dictionary to a file with the given filename.
run
Run the backup
BackupError
Bases: Exception
Exception
General backup error
__str__
Return str(self).
Backup implementation for any backend (using the QueryBuilder).
aiida.manage.backup.backup_general.
Backup
Bases: aiida.manage.backup.backup_base.AbstractBackup
aiida.manage.backup.backup_base.AbstractBackup
Backup for any backend
query_set (QueryBuilder) – QueryBuilder object
QueryBuilder
Generator, returning the results of the QueryBuilder query.
list
BackupError – if the number of yielded items in the list from iterall() is more than 1.
Get Nodes and Worflows query set from start to end of backup.
start_of_backup – datetime object with start datetime of Node modification times for backup.
backup_end_for_this_round – datetime object with end datetime of Node modification times for backup this round.
List of QueryBuilder queries/query.
Retrieve the node repository folder
item (Node) – Subclasses of Node.
Node
Normalized path to the Node’s repository folder.
str
Query first node :return: The first Node object (return specific subclass thereof). :rtype: Node
Class to backup an AiiDA instance profile.
aiida.manage.backup.backup_setup.
BackupSetup
Bases: object
object
This class setups the main backup script related information & files like:
- the backup parameter file. It also allows the user to set it up by answering questions. - the backup folders. - the script that initiates the backup.
construct_backup_variables
Construct backup variables.
create_dir
Create the directories for the backup folder and return its path.
print_info
Write a string with information to stdout.
Run the backup.
Utilities for the backup functionality.
aiida.manage.backup.backup_utils.
ask_question
This method asks a specific question, tries to parse the given reply and then it verifies the parsed answer. :param question: The question to be asked. :param reply_type: The type of the expected answer (int, datetime etc). It is needed for the parsing of the answer. :param allow_none_as_answer: Allow empty answers? :return: The parsed reply.
query_string
Asks a question (with the option to have a default, predefined answer, and depending on the default answer and the answer of the user the following options are available: - If the user replies (with a non empty answer), then his answer is returned. - If the default answer is None then the user has to reply with a non-empty answer. - If the default answer is not None, then it is returned if the user gives an empty answer. In the case of empty default answer and empty reply from the user, None is returned. :param question: The question that we want to ask the user. :param default: The default answer (if there is any) to the question asked. :return: The returned reply.
query_yes_no
Ask a yes/no question via input() and return their answer.
“question” is a string that is presented to the user. “default” is the presumed answer if the user just hits <Enter>. It must be “yes” (the default), “no” or None (meaning an answer is required of the user).
The “answer” return value is True for “yes” or False for “no”.