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)[源代码]#
-
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)[源代码]#
-
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)[源代码]#
-
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)[源代码]#
-
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)[源代码]#
-
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)[源代码]#
-
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)[源代码]#
-
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)[源代码]#
-
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)[源代码]#
-
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)[源代码]#
基类:
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: str | None = None)[源代码]#
Checks if the config needs to be migrated, and performs the migration if needed.
- 参数:
config – the configuration dictionary
filepath – the path to the configuration file (optional, for error reporting)
- 返回:
the migrated configuration dictionary
- aiida.manage.configuration.migrations.migrations.config_needs_migrating(config, filepath: str | None = None)[源代码]#
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.
- 参数:
filepath – the path to the configuration file (optional, for error reporting)
- 返回:
True if the configuration has an older version and needs to be migrated, False otherwise
- 抛出:
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] [源代码]#
Run the registered configuration migrations down to the target version.
- 参数:
config – the configuration dictionary
- 返回:
the migrated configuration dictionary
- aiida.manage.configuration.migrations.migrations.get_current_version(config)[源代码]#
Return the current version of the config.
- 返回:
current config version or 0 if not defined
- aiida.manage.configuration.migrations.migrations.get_oldest_compatible_version(config)[源代码]#
Return the current oldest compatible version of the config.
- 返回:
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] [源代码]#
Run the registered configuration migrations up to the target version.
- 参数:
config – the configuration dictionary
- 返回:
the migrated configuration dictionary