aiida.manage.configuration package¶
Modules related to the configuration of an AiiDA instance.
-
class
aiida.manage.configuration.
Config
(filepath, config)[source]¶ Bases:
object
Object that represents the configuration file of an AiiDA instance.
-
KEY_DEFAULT_PROFILE
= 'default_profile'¶
-
KEY_OPTIONS
= 'options'¶
-
KEY_PROFILES
= 'profiles'¶
-
KEY_VERSION
= 'CONFIG_VERSION'¶
-
KEY_VERSION_CURRENT
= 'CURRENT'¶
-
KEY_VERSION_OLDEST_COMPATIBLE
= 'OLDEST_COMPATIBLE'¶
-
__dict__
= mappingproxy({'__module__': 'aiida.manage.configuration.config', '__doc__': 'Object that represents the configuration file of an AiiDA instance.', 'KEY_VERSION': 'CONFIG_VERSION', 'KEY_VERSION_CURRENT': 'CURRENT', 'KEY_VERSION_OLDEST_COMPATIBLE': 'OLDEST_COMPATIBLE', 'KEY_DEFAULT_PROFILE': 'default_profile', 'KEY_PROFILES': 'profiles', 'KEY_OPTIONS': 'options', '__init__': <function Config.__init__>, '__eq__': <function Config.__eq__>, '__ne__': <function Config.__ne__>, 'handle_invalid': <function Config.handle_invalid>, 'dictionary': <property object>, 'version': <property object>, 'version_oldest_compatible': <property object>, 'version_settings': <property object>, 'filepath': <property object>, 'dirpath': <property object>, 'default_profile_name': <property object>, 'current_profile': <property object>, 'profile_names': <property object>, 'profiles': <property object>, 'validate_profile': <function Config.validate_profile>, 'get_profile': <function Config.get_profile>, 'add_profile': <function Config.add_profile>, 'update_profile': <function Config.update_profile>, 'remove_profile': <function Config.remove_profile>, 'set_default_profile': <function Config.set_default_profile>, 'options': <property object>, 'set_option': <function Config.set_option>, 'unset_option': <function Config.unset_option>, 'get_option': <function Config.get_option>, 'store': <function Config.store>, '_backup': <function Config._backup>, '__dict__': <attribute '__dict__' of 'Config' objects>, '__weakref__': <attribute '__weakref__' of 'Config' objects>, '__hash__': None})¶
-
__hash__
= None¶
-
__init__
(filepath, config)[source]¶ Instantiate a configuration object from a configuration dictionary and its filepath.
If an empty dictionary is passed, the constructor will create the skeleton configuration dictionary.
- Parameters
filepath – the absolute filepath of the configuration file
config – the content of the configuration file in dictionary form
-
__module__
= 'aiida.manage.configuration.config'¶
-
__ne__
(other)[source]¶ Two configurations are considered unequal, when their dictionaries are unequal.
-
__weakref__
¶ list of weak references to the object (if defined)
-
add_profile
(profile)[source]¶ Add a profile to the configuration.
- Parameters
profile – the profile configuration dictionary
- Returns
self
-
property
current_profile
¶ Return the currently loaded profile.
- Returns
the current profile or None if not defined
-
property
default_profile_name
¶ Return the default profile name.
- Returns
the default profile name or None if not defined
-
property
dictionary
¶ Return the dictionary representation of the config as it would be written to file.
- Returns
dictionary representation of config as it should be written to file
-
property
dirpath
¶
-
property
filepath
¶
-
get_option
(option_name, scope=None, default=True)[source]¶ Get a configuration option for a certain scope.
- Parameters
option_name – the name of the configuration option
scope – get the option for this profile or globally if not specified
default – boolean, If True will return the option default, even if not defined within the given scope
- Returns
the option value or None if not set for the given scope
-
get_profile
(name=None)[source]¶ Return the profile for the given name or the default one if not specified.
- Returns
the profile instance or None if it does not exist
- Raises
aiida.common.ProfileConfigurationError – if the name is not found in the configuration file
-
handle_invalid
(message)[source]¶ Handle an incoming invalid configuration dictionary.
The current content of the configuration file will be written to a backup file.
- Parameters
message – a string message to echo with describing the infraction
-
property
options
¶
-
property
profile_names
¶ Return the list of profile names.
- Returns
list of profile names
-
property
profiles
¶ Return the list of profiles.
- Returns
the profiles
- Return type
list of Profile instances
-
remove_profile
(name)[source]¶ Remove a profile from the configuration.
- Parameters
name – the name of the profile to remove
- Raises
aiida.common.ProfileConfigurationError – if the given profile does not exist
- Returns
self
-
set_default_profile
(name, overwrite=False)[source]¶ Set the given profile as the new default.
- Parameters
name – name of the profile to set as new default
overwrite – when True, set the profile as the new default even if a default profile is already defined
- Raises
aiida.common.ProfileConfigurationError – if the given profile does not exist
- Returns
self
-
set_option
(option_name, option_value, scope=None, override=True)[source]¶ Set a configuration option for a certain scope.
- Parameters
option_name – the name of the configuration option
option_value – the option value
scope – set the option for this profile or globally if not specified
override – boolean, if False, will not override the option if it already exists
-
unset_option
(option_name, scope=None)[source]¶ Unset a configuration option for a certain scope.
- Parameters
option_name – the name of the configuration option
scope – unset the option for this profile or globally if not specified
-
update_profile
(profile)[source]¶ Update a profile in the configuration.
- Parameters
profile – the profile instance to update
- Returns
self
-
validate_profile
(name)[source]¶ Validate that a profile exists.
- Parameters
name – name of the profile:
- Raises
aiida.common.ProfileConfigurationError – if the name is not found in the configuration file
-
property
version
¶
-
property
version_oldest_compatible
¶
-
property
version_settings
¶
-
-
aiida.manage.configuration.
get_option
(option_name)[source]¶ Return a configuration option.configuration
- Parameters
option_name – the name of the configuration option
- Returns
the configuration option
- Raises
ValueError – if the configuration option does not exist
-
aiida.manage.configuration.
get_option_names
()[source]¶ Return a list of available option names.
- Returns
list of available option names
-
aiida.manage.configuration.
parse_option
(option_name, option_value)[source]¶ Parse and validate a value for a configuration option.
- Parameters
option_name – the name of the configuration option
option_value – the option value
- Returns
a tuple of the option and the parsed value
-
class
aiida.manage.configuration.
Profile
(name, attributes, from_config=False)[source]¶ Bases:
object
Class that models a profile as it is stored in the configuration file of an AiiDA instance.
-
KEY_DATABASE_BACKEND
= 'AIIDADB_BACKEND'¶
-
KEY_DATABASE_ENGINE
= 'AIIDADB_ENGINE'¶
-
KEY_DATABASE_HOSTNAME
= 'AIIDADB_HOST'¶
-
KEY_DATABASE_NAME
= 'AIIDADB_NAME'¶
-
KEY_DATABASE_PASSWORD
= 'AIIDADB_PASS'¶
-
KEY_DATABASE_PORT
= 'AIIDADB_PORT'¶
-
KEY_DATABASE_USERNAME
= 'AIIDADB_USER'¶
-
KEY_DEFAULT_USER
= 'default_user_email'¶
-
KEY_OPTIONS
= 'options'¶
-
KEY_REPOSITORY_URI
= 'AIIDADB_REPOSITORY_URI'¶
-
KEY_UUID
= 'PROFILE_UUID'¶
-
RMQ_PREFIX
= 'aiida-{uuid}'¶
-
__dict__
= mappingproxy({'__module__': 'aiida.manage.configuration.profile', '__doc__': 'Class that models a profile as it is stored in the configuration file of an AiiDA instance.', 'RMQ_PREFIX': 'aiida-{uuid}', 'KEY_OPTIONS': 'options', 'KEY_UUID': 'PROFILE_UUID', 'KEY_DEFAULT_USER': 'default_user_email', 'KEY_DATABASE_ENGINE': 'AIIDADB_ENGINE', 'KEY_DATABASE_BACKEND': 'AIIDADB_BACKEND', 'KEY_DATABASE_NAME': 'AIIDADB_NAME', 'KEY_DATABASE_PORT': 'AIIDADB_PORT', 'KEY_DATABASE_HOSTNAME': 'AIIDADB_HOST', 'KEY_DATABASE_USERNAME': 'AIIDADB_USER', 'KEY_DATABASE_PASSWORD': 'AIIDADB_PASS', 'KEY_REPOSITORY_URI': 'AIIDADB_REPOSITORY_URI', '_map_config_to_internal': {'options': 'options', 'PROFILE_UUID': 'uuid', 'default_user_email': 'default_user', 'AIIDADB_ENGINE': 'database_engine', 'AIIDADB_BACKEND': 'database_backend', 'AIIDADB_NAME': 'database_name', 'AIIDADB_PORT': 'database_port', 'AIIDADB_HOST': 'database_hostname', 'AIIDADB_USER': 'database_username', 'AIIDADB_PASS': 'database_password', 'AIIDADB_REPOSITORY_URI': 'repository_uri'}, 'contains_unknown_keys': <classmethod object>, '__init__': <function Profile.__init__>, 'uuid': <property object>, 'default_user': <property object>, 'database_engine': <property object>, 'database_backend': <property object>, 'database_name': <property object>, 'database_port': <property object>, 'database_hostname': <property object>, 'database_username': <property object>, 'database_password': <property object>, 'repository_uri': <property object>, 'options': <property object>, 'get_option': <function Profile.get_option>, 'set_option': <function Profile.set_option>, 'unset_option': <function Profile.unset_option>, 'name': <property object>, 'dictionary': <property object>, 'rmq_prefix': <property object>, 'is_test_profile': <property object>, 'repository_path': <property object>, '_parse_repository_uri': <function Profile._parse_repository_uri>, 'configure_repository': <function Profile.configure_repository>, 'filepaths': <property object>, '__dict__': <attribute '__dict__' of 'Profile' objects>, '__weakref__': <attribute '__weakref__' of 'Profile' objects>})¶
-
__init__
(name, attributes, from_config=False)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
__module__
= 'aiida.manage.configuration.profile'¶
-
__weakref__
¶ list of weak references to the object (if defined)
-
_map_config_to_internal
= {'AIIDADB_BACKEND': 'database_backend', 'AIIDADB_ENGINE': 'database_engine', 'AIIDADB_HOST': 'database_hostname', 'AIIDADB_NAME': 'database_name', 'AIIDADB_PASS': 'database_password', 'AIIDADB_PORT': 'database_port', 'AIIDADB_REPOSITORY_URI': 'repository_uri', 'AIIDADB_USER': 'database_username', 'PROFILE_UUID': 'uuid', 'default_user_email': 'default_user', 'options': 'options'}¶
-
_parse_repository_uri
()[source]¶ This function validates the REPOSITORY_URI, that should be in the format protocol://address
- Note
At the moment, only the file protocol is supported.
- Returns
a tuple (protocol, address).
-
configure_repository
()[source]¶ Validates the configured repository and in the case of a file system repo makes sure the folder exists.
-
classmethod
contains_unknown_keys
(dictionary)[source]¶ Return whether the profile dictionary contains any unsupported keys.
- Parameters
dictionary – a profile dictionary
- Returns
boolean, True when the dictionay contains unsupported keys
-
property
database_backend
¶
-
property
database_engine
¶
-
property
database_hostname
¶
-
property
database_name
¶
-
property
database_password
¶
-
property
database_port
¶
-
property
database_username
¶
-
property
default_user
¶
-
property
dictionary
¶ Return the profile attributes as a dictionary with keys as it is stored in the config
- Returns
the profile configuration dictionary
-
property
filepaths
¶ Return the filepaths used by this profile.
- Returns
a dictionary of filepaths
-
property
is_test_profile
¶ Return whether the profile is a test profile
- Returns
boolean, True if test profile, False otherwise
-
property
name
¶ Return the profile name.
- Returns
the profile name
-
property
options
¶
-
property
repository_path
¶ Return the absolute path of the repository configured for this profile.
- Returns
absolute filepath of the profile’s file repository
-
property
repository_uri
¶
-
property
rmq_prefix
¶ Return the prefix that should be used for RMQ resources
- Returns
the rmq prefix string
-
set_option
(option_key, value, override=True)[source]¶ Set a configuration option for a certain scope.
- Parameters
option_key – the key of the configuration option
option_value – the option value
override – boolean, if False, will not override the option if it already exists
-
property
uuid
¶ Return the profile uuid.
- Returns
string UUID
-
-
aiida.manage.configuration.
get_config
(create=False)[source]¶ Return the current configuration.
If the configuration has not been loaded yet, it will be loaded first and then returned.
Note: this function should only be called by parts of the code that expect that a complete AiiDA instance exists, i.e. an AiiDA folder exists and contains a valid configuration file.
- Parameters
create (bool) – if True, will create the configuration file if it does not already exist
- Returns
the config
- Return type
- Raises
aiida.common.ConfigurationError – if the configuration file could not be found, read or deserialized
-
aiida.manage.configuration.
get_config_option
(option_name)[source]¶ Return the value for the given configuration option.
This function will attempt to load the value of the option as defined for the current profile or otherwise as defined configuration wide. If no configuration is yet loaded, this function will fall back on the default that may be defined for the option itself. This is useful for options that need to be defined at loading time of AiiDA when no configuration is yet loaded or may not even yet exist. In cases where one expects a profile to be loaded, preference should be given to retrieving the option through the Config instance and its get_option method.
- Parameters
option_name (str) – the name of the configuration option
- Returns
option value as specified for the profile/configuration if loaded, otherwise option default
-
aiida.manage.configuration.
load_profile
(profile=None)[source]¶ Load a profile.
Note
if a profile is already loaded and no explicit profile is specified, nothing will be done
- Parameters
profile (str) – the name of the profile to load, by default will use the one marked as default in the config
- Returns
the loaded Profile instance
- Return type
- Raises
aiida.common.exceptions.InvalidOperation – if the backend of another profile has already been loaded
-
aiida.manage.configuration.
reset_config
()[source]¶ Reset the globally loaded config.
Warning
This is experimental functionality and should for now be used only internally. If the reset is unclean weird unknown side-effects may occur that end up corrupting or destroying data.
Submodules¶
Module that defines the configuration file of an AiiDA instance and functions to create and load it.
-
class
aiida.manage.configuration.config.
Config
(filepath, config)[source]¶ Bases:
object
Object that represents the configuration file of an AiiDA instance.
-
KEY_DEFAULT_PROFILE
= 'default_profile'¶
-
KEY_OPTIONS
= 'options'¶
-
KEY_PROFILES
= 'profiles'¶
-
KEY_VERSION
= 'CONFIG_VERSION'¶
-
KEY_VERSION_CURRENT
= 'CURRENT'¶
-
KEY_VERSION_OLDEST_COMPATIBLE
= 'OLDEST_COMPATIBLE'¶
-
__dict__
= mappingproxy({'__module__': 'aiida.manage.configuration.config', '__doc__': 'Object that represents the configuration file of an AiiDA instance.', 'KEY_VERSION': 'CONFIG_VERSION', 'KEY_VERSION_CURRENT': 'CURRENT', 'KEY_VERSION_OLDEST_COMPATIBLE': 'OLDEST_COMPATIBLE', 'KEY_DEFAULT_PROFILE': 'default_profile', 'KEY_PROFILES': 'profiles', 'KEY_OPTIONS': 'options', '__init__': <function Config.__init__>, '__eq__': <function Config.__eq__>, '__ne__': <function Config.__ne__>, 'handle_invalid': <function Config.handle_invalid>, 'dictionary': <property object>, 'version': <property object>, 'version_oldest_compatible': <property object>, 'version_settings': <property object>, 'filepath': <property object>, 'dirpath': <property object>, 'default_profile_name': <property object>, 'current_profile': <property object>, 'profile_names': <property object>, 'profiles': <property object>, 'validate_profile': <function Config.validate_profile>, 'get_profile': <function Config.get_profile>, 'add_profile': <function Config.add_profile>, 'update_profile': <function Config.update_profile>, 'remove_profile': <function Config.remove_profile>, 'set_default_profile': <function Config.set_default_profile>, 'options': <property object>, 'set_option': <function Config.set_option>, 'unset_option': <function Config.unset_option>, 'get_option': <function Config.get_option>, 'store': <function Config.store>, '_backup': <function Config._backup>, '__dict__': <attribute '__dict__' of 'Config' objects>, '__weakref__': <attribute '__weakref__' of 'Config' objects>, '__hash__': None})¶
-
__hash__
= None¶
-
__init__
(filepath, config)[source]¶ Instantiate a configuration object from a configuration dictionary and its filepath.
If an empty dictionary is passed, the constructor will create the skeleton configuration dictionary.
- Parameters
filepath – the absolute filepath of the configuration file
config – the content of the configuration file in dictionary form
-
__module__
= 'aiida.manage.configuration.config'¶
-
__ne__
(other)[source]¶ Two configurations are considered unequal, when their dictionaries are unequal.
-
__weakref__
¶ list of weak references to the object (if defined)
-
add_profile
(profile)[source]¶ Add a profile to the configuration.
- Parameters
profile – the profile configuration dictionary
- Returns
self
-
property
current_profile
¶ Return the currently loaded profile.
- Returns
the current profile or None if not defined
-
property
default_profile_name
¶ Return the default profile name.
- Returns
the default profile name or None if not defined
-
property
dictionary
¶ Return the dictionary representation of the config as it would be written to file.
- Returns
dictionary representation of config as it should be written to file
-
property
dirpath
¶
-
property
filepath
¶
-
get_option
(option_name, scope=None, default=True)[source]¶ Get a configuration option for a certain scope.
- Parameters
option_name – the name of the configuration option
scope – get the option for this profile or globally if not specified
default – boolean, If True will return the option default, even if not defined within the given scope
- Returns
the option value or None if not set for the given scope
-
get_profile
(name=None)[source]¶ Return the profile for the given name or the default one if not specified.
- Returns
the profile instance or None if it does not exist
- Raises
aiida.common.ProfileConfigurationError – if the name is not found in the configuration file
-
handle_invalid
(message)[source]¶ Handle an incoming invalid configuration dictionary.
The current content of the configuration file will be written to a backup file.
- Parameters
message – a string message to echo with describing the infraction
-
property
options
¶
-
property
profile_names
¶ Return the list of profile names.
- Returns
list of profile names
-
property
profiles
¶ Return the list of profiles.
- Returns
the profiles
- Return type
list of Profile instances
-
remove_profile
(name)[source]¶ Remove a profile from the configuration.
- Parameters
name – the name of the profile to remove
- Raises
aiida.common.ProfileConfigurationError – if the given profile does not exist
- Returns
self
-
set_default_profile
(name, overwrite=False)[source]¶ Set the given profile as the new default.
- Parameters
name – name of the profile to set as new default
overwrite – when True, set the profile as the new default even if a default profile is already defined
- Raises
aiida.common.ProfileConfigurationError – if the given profile does not exist
- Returns
self
-
set_option
(option_name, option_value, scope=None, override=True)[source]¶ Set a configuration option for a certain scope.
- Parameters
option_name – the name of the configuration option
option_value – the option value
scope – set the option for this profile or globally if not specified
override – boolean, if False, will not override the option if it already exists
-
unset_option
(option_name, scope=None)[source]¶ Unset a configuration option for a certain scope.
- Parameters
option_name – the name of the configuration option
scope – unset the option for this profile or globally if not specified
-
update_profile
(profile)[source]¶ Update a profile in the configuration.
- Parameters
profile – the profile instance to update
- Returns
self
-
validate_profile
(name)[source]¶ Validate that a profile exists.
- Parameters
name – name of the profile:
- Raises
aiida.common.ProfileConfigurationError – if the name is not found in the configuration file
-
property
version
¶
-
property
version_oldest_compatible
¶
-
property
version_settings
¶
-
Definition of known configuration options and methods to parse and get option values.
-
aiida.manage.configuration.options.
get_option
(option_name)[source]¶ Return a configuration option.configuration
- Parameters
option_name – the name of the configuration option
- Returns
the configuration option
- Raises
ValueError – if the configuration option does not exist
-
aiida.manage.configuration.options.
get_option_names
()[source]¶ Return a list of available option names.
- Returns
list of available option names
-
aiida.manage.configuration.options.
parse_option
(option_name, option_value)[source]¶ Parse and validate a value for a configuration option.
- Parameters
option_name – the name of the configuration option
option_value – the option value
- Returns
a tuple of the option and the parsed value
AiiDA profile related code
-
class
aiida.manage.configuration.profile.
Profile
(name, attributes, from_config=False)[source]¶ Bases:
object
Class that models a profile as it is stored in the configuration file of an AiiDA instance.
-
KEY_DATABASE_BACKEND
= 'AIIDADB_BACKEND'¶
-
KEY_DATABASE_ENGINE
= 'AIIDADB_ENGINE'¶
-
KEY_DATABASE_HOSTNAME
= 'AIIDADB_HOST'¶
-
KEY_DATABASE_NAME
= 'AIIDADB_NAME'¶
-
KEY_DATABASE_PASSWORD
= 'AIIDADB_PASS'¶
-
KEY_DATABASE_PORT
= 'AIIDADB_PORT'¶
-
KEY_DATABASE_USERNAME
= 'AIIDADB_USER'¶
-
KEY_DEFAULT_USER
= 'default_user_email'¶
-
KEY_OPTIONS
= 'options'¶
-
KEY_REPOSITORY_URI
= 'AIIDADB_REPOSITORY_URI'¶
-
KEY_UUID
= 'PROFILE_UUID'¶
-
RMQ_PREFIX
= 'aiida-{uuid}'¶
-
__dict__
= mappingproxy({'__module__': 'aiida.manage.configuration.profile', '__doc__': 'Class that models a profile as it is stored in the configuration file of an AiiDA instance.', 'RMQ_PREFIX': 'aiida-{uuid}', 'KEY_OPTIONS': 'options', 'KEY_UUID': 'PROFILE_UUID', 'KEY_DEFAULT_USER': 'default_user_email', 'KEY_DATABASE_ENGINE': 'AIIDADB_ENGINE', 'KEY_DATABASE_BACKEND': 'AIIDADB_BACKEND', 'KEY_DATABASE_NAME': 'AIIDADB_NAME', 'KEY_DATABASE_PORT': 'AIIDADB_PORT', 'KEY_DATABASE_HOSTNAME': 'AIIDADB_HOST', 'KEY_DATABASE_USERNAME': 'AIIDADB_USER', 'KEY_DATABASE_PASSWORD': 'AIIDADB_PASS', 'KEY_REPOSITORY_URI': 'AIIDADB_REPOSITORY_URI', '_map_config_to_internal': {'options': 'options', 'PROFILE_UUID': 'uuid', 'default_user_email': 'default_user', 'AIIDADB_ENGINE': 'database_engine', 'AIIDADB_BACKEND': 'database_backend', 'AIIDADB_NAME': 'database_name', 'AIIDADB_PORT': 'database_port', 'AIIDADB_HOST': 'database_hostname', 'AIIDADB_USER': 'database_username', 'AIIDADB_PASS': 'database_password', 'AIIDADB_REPOSITORY_URI': 'repository_uri'}, 'contains_unknown_keys': <classmethod object>, '__init__': <function Profile.__init__>, 'uuid': <property object>, 'default_user': <property object>, 'database_engine': <property object>, 'database_backend': <property object>, 'database_name': <property object>, 'database_port': <property object>, 'database_hostname': <property object>, 'database_username': <property object>, 'database_password': <property object>, 'repository_uri': <property object>, 'options': <property object>, 'get_option': <function Profile.get_option>, 'set_option': <function Profile.set_option>, 'unset_option': <function Profile.unset_option>, 'name': <property object>, 'dictionary': <property object>, 'rmq_prefix': <property object>, 'is_test_profile': <property object>, 'repository_path': <property object>, '_parse_repository_uri': <function Profile._parse_repository_uri>, 'configure_repository': <function Profile.configure_repository>, 'filepaths': <property object>, '__dict__': <attribute '__dict__' of 'Profile' objects>, '__weakref__': <attribute '__weakref__' of 'Profile' objects>})¶
-
__init__
(name, attributes, from_config=False)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
__module__
= 'aiida.manage.configuration.profile'¶
-
__weakref__
¶ list of weak references to the object (if defined)
-
_map_config_to_internal
= {'AIIDADB_BACKEND': 'database_backend', 'AIIDADB_ENGINE': 'database_engine', 'AIIDADB_HOST': 'database_hostname', 'AIIDADB_NAME': 'database_name', 'AIIDADB_PASS': 'database_password', 'AIIDADB_PORT': 'database_port', 'AIIDADB_REPOSITORY_URI': 'repository_uri', 'AIIDADB_USER': 'database_username', 'PROFILE_UUID': 'uuid', 'default_user_email': 'default_user', 'options': 'options'}¶
-
_parse_repository_uri
()[source]¶ This function validates the REPOSITORY_URI, that should be in the format protocol://address
- Note
At the moment, only the file protocol is supported.
- Returns
a tuple (protocol, address).
-
configure_repository
()[source]¶ Validates the configured repository and in the case of a file system repo makes sure the folder exists.
-
classmethod
contains_unknown_keys
(dictionary)[source]¶ Return whether the profile dictionary contains any unsupported keys.
- Parameters
dictionary – a profile dictionary
- Returns
boolean, True when the dictionay contains unsupported keys
-
property
database_backend
¶
-
property
database_engine
¶
-
property
database_hostname
¶
-
property
database_name
¶
-
property
database_password
¶
-
property
database_port
¶
-
property
database_username
¶
-
property
default_user
¶
-
property
dictionary
¶ Return the profile attributes as a dictionary with keys as it is stored in the config
- Returns
the profile configuration dictionary
-
property
filepaths
¶ Return the filepaths used by this profile.
- Returns
a dictionary of filepaths
-
property
is_test_profile
¶ Return whether the profile is a test profile
- Returns
boolean, True if test profile, False otherwise
-
property
name
¶ Return the profile name.
- Returns
the profile name
-
property
options
¶
-
property
repository_path
¶ Return the absolute path of the repository configured for this profile.
- Returns
absolute filepath of the profile’s file repository
-
property
repository_uri
¶
-
property
rmq_prefix
¶ Return the prefix that should be used for RMQ resources
- Returns
the rmq prefix string
-
set_option
(option_key, value, override=True)[source]¶ Set a configuration option for a certain scope.
- Parameters
option_key – the key of the configuration option
option_value – the option value
override – boolean, if False, will not override the option if it already exists
-
property
uuid
¶ Return the profile uuid.
- Returns
string UUID
-
Base settings required for the configuration of an AiiDA instance.
-
aiida.manage.configuration.settings.
create_directory
(path)[source]¶ Attempt to create the configuration folder at the given path skipping if it already exists
- Parameters
path – an absolute path to create a directory at
-
aiida.manage.configuration.settings.
create_instance_directories
()[source]¶ Create the base directories required for a new AiiDA instance.
This will create the base AiiDA directory defined by the AIIDA_CONFIG_FOLDER variable, unless it already exists. Subsequently, it will create the daemon directory within it and the daemon log directory.
-
aiida.manage.configuration.settings.
set_configuration_directory
()[source]¶ Determine the location of the configuration directory and set the related global variables.
The location of the configuration folder will be determined and optionally created following these heuristics:
If the AIIDA_PATH variable is set, all the paths will be checked to see if they contain a configuration folder. The first one to be encountered will be set as AIIDA_CONFIG_FOLDER. If none of them contain one, a configuration folder will be created in the last path considered.
If the AIIDA_PATH variable is not set the DEFAULT_AIIDA_PATH value will be used as base path and if it does not yet contain a configuration folder, one will be created.
In principle then, a configuration folder should always be found or automatically created.
Module that defines methods required to setup a new AiiDA instance.
-
aiida.manage.configuration.setup.
delete_db
(profile, non_interactive=True, verbose=False)[source]¶ Delete an AiiDA database associated with an AiiDA profile.
- Parameters
profile (
aiida.manage.configuration.profile.Profile
) – AiiDA Profilenon_interactive (bool) – do not prompt for configuration values, fail if not all values are given as kwargs.
verbose (bool) – if True, print parameters of DB connection
-
aiida.manage.configuration.setup.
delete_from_config
(profile, non_interactive=True)[source]¶ Delete an AiiDA profile from the config file.
- Parameters
profile (
aiida.manage.configuration.profile.Profile
) – AiiDA Profilenon_interactive (bool) – do not prompt for configuration values, fail if not all values are given as kwargs.
-
aiida.manage.configuration.setup.
delete_profile
(profile, non_interactive=True, include_db=True, include_repository=True, include_config=True)[source]¶ Delete an AiiDA profile and AiiDA user.
- Parameters
profile (
aiida.manage.configuration.profile.Profile
) – AiiDA profilenon_interactive – do not prompt for configuration values, fail if not all values are given as kwargs.
include_db (bool) – Include deletion of associated database
include_repository (bool) – Include deletion of associated file repository
include_config (bool) – Include deletion of entry from AiiDA configuration file
-
aiida.manage.configuration.setup.
delete_repository
(profile, non_interactive=True)[source]¶ Delete an AiiDA file repository associated with an AiiDA profile.
- Parameters
profile (
aiida.manage.configuration.profile.Profile
) – AiiDA Profilenon_interactive (bool) – do not prompt for configuration values, fail if not all values are given as kwargs.