aiida.manage.configuration.migrations package#
Methods and definitions of migrations for the configuration file of an AiiDA instance.
Submodules#
Define the current configuration version and migrations.
- class aiida.manage.configuration.migrations.migrations.AbstractStorageAndProcess(*args, **kwargs)[source]#
Bases:
aiida.manage.configuration.migrations.migrations.SingleMigration
Move the storage config under a top-level “storage” key and rabbitmq config under “processing”.
This allows for different storage backends to have different configuration.
- __abstractmethods__ = frozenset({})#
- __module__ = 'aiida.manage.configuration.migrations.migrations'#
- __parameters__ = ()#
- __subclasshook__()#
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
- _abc_impl = <_abc._abc_data object>#
- _is_protocol = False#
- process_keys = ('broker_protocol', 'broker_username', 'broker_password', 'broker_host', 'broker_port', 'broker_virtual_host', 'broker_parameters')#
- storage_conversions = (('AIIDADB_ENGINE', 'database_engine'), ('AIIDADB_HOST', 'database_hostname'), ('AIIDADB_PORT', 'database_port'), ('AIIDADB_USER', 'database_username'), ('AIIDADB_PASS', 'database_password'), ('AIIDADB_NAME', 'database_name'), ('AIIDADB_REPOSITORY_URI', 'repository_uri'))#
- class aiida.manage.configuration.migrations.migrations.AddMessageBroker(*args, **kwargs)[source]#
Bases:
aiida.manage.configuration.migrations.migrations.SingleMigration
Add the configuration for the message broker, which was not configurable up to now.
- __abstractmethods__ = frozenset({})#
- __module__ = 'aiida.manage.configuration.migrations.migrations'#
- __parameters__ = ()#
- __subclasshook__()#
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
- _abc_impl = <_abc._abc_data object>#
- _is_protocol = False#
- class aiida.manage.configuration.migrations.migrations.AddPrefixToStorageBackendTypes(*args, **kwargs)[source]#
Bases:
aiida.manage.configuration.migrations.migrations.SingleMigration
The
storage.backend
key should be prefixed withcore.
.At this point, it should only ever contain
psql_dos
which should therefore becomecore.psql_dos
. To cover for cases where people manually added a read onlysqlite_zip
profile, we also migrate that.- __abstractmethods__ = frozenset({})#
- __module__ = 'aiida.manage.configuration.migrations.migrations'#
- __parameters__ = ()#
- __subclasshook__()#
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
- _abc_impl = <_abc._abc_data object>#
- _is_protocol = False#
- class aiida.manage.configuration.migrations.migrations.AddProfileUuid(*args, **kwargs)[source]#
Bases:
aiida.manage.configuration.migrations.migrations.SingleMigration
Add the required values for a new default profile.
PROFILE_UUID
The profile uuid will be used as a general purpose identifier for the profile, in for example the RabbitMQ message queues and exchanges.
- __abstractmethods__ = frozenset({})#
- __module__ = 'aiida.manage.configuration.migrations.migrations'#
- __parameters__ = ()#
- __subclasshook__()#
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
- _abc_impl = <_abc._abc_data object>#
- _is_protocol = False#
- class aiida.manage.configuration.migrations.migrations.AddTestProfileKey(*args, **kwargs)[source]#
Bases:
aiida.manage.configuration.migrations.migrations.SingleMigration
Add the
test_profile
key.- __abstractmethods__ = frozenset({})#
- __module__ = 'aiida.manage.configuration.migrations.migrations'#
- __parameters__ = ()#
- __subclasshook__()#
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
- _abc_impl = <_abc._abc_data object>#
- _is_protocol = False#
- class aiida.manage.configuration.migrations.migrations.Initial(*args, **kwargs)[source]#
Bases:
aiida.manage.configuration.migrations.migrations.SingleMigration
Base migration (no-op).
- __abstractmethods__ = frozenset({})#
- __module__ = 'aiida.manage.configuration.migrations.migrations'#
- __parameters__ = ()#
- __subclasshook__()#
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
- _abc_impl = <_abc._abc_data object>#
- _is_protocol = False#
- class aiida.manage.configuration.migrations.migrations.MergeStorageBackendTypes(*args, **kwargs)[source]#
Bases:
aiida.manage.configuration.migrations.migrations.SingleMigration
django and sqlalchemy are now merged into psql_dos.
The legacy name is stored under the _v6_backend key, to allow for downgrades.
- __abstractmethods__ = frozenset({})#
- __module__ = 'aiida.manage.configuration.migrations.migrations'#
- __parameters__ = ()#
- __subclasshook__()#
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
- _abc_impl = <_abc._abc_data object>#
- _is_protocol = False#
- class aiida.manage.configuration.migrations.migrations.SimplifyDefaultProfiles(*args, **kwargs)[source]#
Bases:
aiida.manage.configuration.migrations.migrations.SingleMigration
Replace process specific default profiles with single default profile key.
The concept of a different ‘process’ for a profile has been removed and as such the default profiles key in the configuration no longer needs a value per process (‘verdi’, ‘daemon’). We remove the dictionary ‘default_profiles’ and replace it with a simple value ‘default_profile’.
- __abstractmethods__ = frozenset({})#
- __module__ = 'aiida.manage.configuration.migrations.migrations'#
- __parameters__ = ()#
- __subclasshook__()#
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
- _abc_impl = <_abc._abc_data object>#
- _is_protocol = False#
- class aiida.manage.configuration.migrations.migrations.SimplifyOptions(*args, **kwargs)[source]#
Bases:
aiida.manage.configuration.migrations.migrations.SingleMigration
Remove unnecessary difference between file/internal representation of options
- __abstractmethods__ = frozenset({})#
- __module__ = 'aiida.manage.configuration.migrations.migrations'#
- __parameters__ = ()#
- __subclasshook__()#
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
- _abc_impl = <_abc._abc_data object>#
- _is_protocol = False#
- conversions = (('runner_poll_interval', 'runner.poll.interval'), ('daemon_default_workers', 'daemon.default_workers'), ('daemon_timeout', 'daemon.timeout'), ('daemon_worker_process_slots', 'daemon.worker_process_slots'), ('db_batch_size', 'db.batch_size'), ('verdi_shell_auto_import', 'verdi.shell.auto_import'), ('logging_aiida_log_level', 'logging.aiida_loglevel'), ('logging_db_log_level', 'logging.db_loglevel'), ('logging_plumpy_log_level', 'logging.plumpy_loglevel'), ('logging_kiwipy_log_level', 'logging.kiwipy_loglevel'), ('logging_paramiko_log_level', 'logging.paramiko_loglevel'), ('logging_alembic_log_level', 'logging.alembic_loglevel'), ('logging_sqlalchemy_loglevel', 'logging.sqlalchemy_loglevel'), ('logging_circus_log_level', 'logging.circus_loglevel'), ('user_email', 'autofill.user.email'), ('user_first_name', 'autofill.user.first_name'), ('user_last_name', 'autofill.user.last_name'), ('user_institution', 'autofill.user.institution'), ('show_deprecations', 'warnings.showdeprecations'), ('task_retry_initial_interval', 'transport.task_retry_initial_interval'), ('task_maximum_attempts', 'transport.task_maximum_attempts'))#
- class aiida.manage.configuration.migrations.migrations.SingleMigration(*args, **kwargs)[source]#
Bases:
Protocol
A single migration of the configuration.
- __abstractmethods__ = frozenset({})#
- __annotations__ = {'down_compatible': <class 'int'>, 'down_revision': <class 'int'>, 'up_compatible': <class 'int'>, 'up_revision': <class 'int'>}#
- __dict__ = mappingproxy({'__module__': 'aiida.manage.configuration.migrations.migrations', '__annotations__': {'down_revision': <class 'int'>, 'down_compatible': <class 'int'>, 'up_revision': <class 'int'>, 'up_compatible': <class 'int'>}, '__doc__': 'A single migration of the configuration.', 'upgrade': <function SingleMigration.upgrade>, 'downgrade': <function SingleMigration.downgrade>, '__dict__': <attribute '__dict__' of 'SingleMigration' objects>, '__weakref__': <attribute '__weakref__' of 'SingleMigration' objects>, '__parameters__': (), '_is_protocol': True, '__subclasshook__': <function Protocol.__init_subclass__.<locals>._proto_hook>, '__init__': <function _no_init_or_replace_init>, '__abstractmethods__': frozenset(), '_abc_impl': <_abc._abc_data object>})#
- __init__(*args, **kwargs)#
- __module__ = 'aiida.manage.configuration.migrations.migrations'#
- __parameters__ = ()#
- __subclasshook__()#
Abstract classes can override this to customize issubclass().
This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).
- __weakref__#
list of weak references to the object (if defined)
- _abc_impl = <_abc._abc_data object>#
- _is_protocol = True#
- aiida.manage.configuration.migrations.migrations.check_and_migrate_config(config, filepath: Optional[str] = None)[source]#
Checks if the config needs to be migrated, and performs the migration if needed.
- Parameters
config – the configuration dictionary
filepath – the path to the configuration file (optional, for error reporting)
- Returns
the migrated configuration dictionary
- aiida.manage.configuration.migrations.migrations.config_needs_migrating(config, filepath: Optional[str] = None)[source]#
Checks if the config needs to be migrated.
If the oldest compatible version of the configuration is higher than the current configuration version defined in the code, the config cannot be used and so the function will raise.
- Parameters
filepath – the path to the configuration file (optional, for error reporting)
- Returns
True if the configuration has an older version and needs to be migrated, False otherwise
- Raises
aiida.common.ConfigurationVersionError – if the config’s oldest compatible version is higher than the current
- aiida.manage.configuration.migrations.migrations.downgrade_config(config: typing.Dict[str, typing.Any], target: int, migrations: typing.Iterable[typing.Type[aiida.manage.configuration.migrations.migrations.SingleMigration]] = (<class 'aiida.manage.configuration.migrations.migrations.Initial'>, <class 'aiida.manage.configuration.migrations.migrations.AddProfileUuid'>, <class 'aiida.manage.configuration.migrations.migrations.SimplifyDefaultProfiles'>, <class 'aiida.manage.configuration.migrations.migrations.AddMessageBroker'>, <class 'aiida.manage.configuration.migrations.migrations.SimplifyOptions'>, <class 'aiida.manage.configuration.migrations.migrations.AbstractStorageAndProcess'>, <class 'aiida.manage.configuration.migrations.migrations.MergeStorageBackendTypes'>, <class 'aiida.manage.configuration.migrations.migrations.AddTestProfileKey'>, <class 'aiida.manage.configuration.migrations.migrations.AddPrefixToStorageBackendTypes'>)) Dict[str, Any] [source]#
Run the registered configuration migrations down to the target version.
- Parameters
config – the configuration dictionary
- Returns
the migrated configuration dictionary
- aiida.manage.configuration.migrations.migrations.get_current_version(config)[source]#
Return the current version of the config.
- Returns
current config version or 0 if not defined
- aiida.manage.configuration.migrations.migrations.get_oldest_compatible_version(config)[source]#
Return the current oldest compatible version of the config.
- Returns
current oldest compatible config version or 0 if not defined
- aiida.manage.configuration.migrations.migrations.upgrade_config(config: typing.Dict[str, typing.Any], target: int = 9, migrations: typing.Iterable[typing.Type[aiida.manage.configuration.migrations.migrations.SingleMigration]] = (<class 'aiida.manage.configuration.migrations.migrations.Initial'>, <class 'aiida.manage.configuration.migrations.migrations.AddProfileUuid'>, <class 'aiida.manage.configuration.migrations.migrations.SimplifyDefaultProfiles'>, <class 'aiida.manage.configuration.migrations.migrations.AddMessageBroker'>, <class 'aiida.manage.configuration.migrations.migrations.SimplifyOptions'>, <class 'aiida.manage.configuration.migrations.migrations.AbstractStorageAndProcess'>, <class 'aiida.manage.configuration.migrations.migrations.MergeStorageBackendTypes'>, <class 'aiida.manage.configuration.migrations.migrations.AddTestProfileKey'>, <class 'aiida.manage.configuration.migrations.migrations.AddPrefixToStorageBackendTypes'>)) Dict[str, Any] [source]#
Run the registered configuration migrations up to the target version.
- Parameters
config – the configuration dictionary
- Returns
the migrated configuration dictionary