aiida.common.additions.config_migrations package¶
Submodules¶
Defines the migration functions between different config versions.
-
class
aiida.common.additions.config_migrations._migrations.
ConfigMigration
(migrate_function, current_version, oldest_version)[source]¶ Bases:
object
Defines a config migration.
Parameters: - migrate_function – Function which transforms the config dict. This function does not need to change the CONFIG_VERSION values.
- current_version (int) – Current config version after the migration.
- oldest_version (int) – Oldest compatible config version after the migration.
-
__dict__
= dict_proxy({'__module__': 'aiida.common.additions.config_migrations._migrations', '__dict__': <attribute '__dict__' of 'ConfigMigration' objects>, 'apply': <function apply>, '__weakref__': <attribute '__weakref__' of 'ConfigMigration' objects>, '__doc__': '\n Defines a config migration.\n\n :param migrate_function: Function which transforms the config dict. This function does not need to change the CONFIG_VERSION values.\n\n :param current_version: Current config version after the migration.\n :type current_version: int\n\n :param oldest_version: Oldest compatible config version after the migration.\n :type oldest_version: int\n ', '__init__': <function __init__>})¶
-
__init__
(migrate_function, current_version, oldest_version)[source]¶ x.__init__(…) initializes x; see help(type(x)) for signature
-
__module__
= 'aiida.common.additions.config_migrations._migrations'¶
-
__weakref__
¶ list of weak references to the object (if defined)
Defines the migrations on the config.json file.
-
aiida.common.additions.config_migrations._utils.
check_and_migrate_config
(config, store=True)[source]¶ Checks if the config needs to be migrated, and performs the migration if needed.
-
aiida.common.additions.config_migrations._utils.
add_config_version
(config, current_version=1, oldest_version=0)[source]¶ Injects the current and oldest compatible version numbers into the config.