aiida.backends package

Submodules

aiida.backends.profile.is_profile_loaded()[source]

Return True if the profile has already been loaded

aiida.backends.profile.load_profile(process=None, profile=None)[source]

Load the profile. This function is called by load_dbenv and SHOULD NOT be called by the user by hand.

class aiida.backends.testbase.AiidaTestCase(methodName='runTest')[source]

Bases: unittest.case.TestCase

This is the base class for AiiDA tests, independent of the backend.

Internally it loads the AiidaTestImplementation subclass according to the current backend

_AiidaTestCase__backend_instance = None
__module__ = 'aiida.backends.testbase'
_class_was_setup = False
classmethod clean_db()[source]
computer

A class that, when used as a decorator, works as if the two decorators @property and @classmethod where applied together (i.e., the object works as a property, both for the Class and for any of its instance; and is called with the class cls rather than with the instance as its first argument).

classmethod get_backend_class()[source]
classmethod insert_data()[source]
setUp()[source]

Hook method for setting up the test fixture before exercising it.

classmethod setUpClass(*args, **kwargs)[source]

Hook method for setting up class fixture before running tests in the class.

tearDown()[source]

Hook method for deconstructing the test fixture after testing it.

classmethod tearDownClass(*args, **kwargs)[source]

Hook method for deconstructing the class fixture after running all tests in the class.

user_email

A class that, when used as a decorator, works as if the two decorators @property and @classmethod where applied together (i.e., the object works as a property, both for the Class and for any of its instance; and is called with the class cls rather than with the instance as its first argument).

aiida.backends.testbase.check_if_tests_can_run()[source]

Check if the tests can run (i.e., if we are in a test profile). Otherwise, raise TestsNotAllowedError.

aiida.backends.testbase.run_aiida_db_tests(tests_to_run, verbose=False)[source]

Run all tests specified in tests_to_run. Return the list of test results.

class aiida.backends.testimplbase.AiidaTestImplementation[source]

Bases: object

For each implementation, define what to do at setUp and tearDown.

Each subclass must reimplement two standard methods (i.e., not classmethods), called respectively setUpClass_method and tearDownClass_method. It is also required to implement setUp_method and tearDown_method to be run for each single test They can set local properties (e.g. self.xxx = yyy) but remember that xxx is not visible to the upper (calling) Test class.

Moreover, it is required that they define in the setUpClass_method the two properties:

  • self.computer that must be a Computer object
  • self.user_email that must be a string

These two are then exposed by the self.get_computer() and self.get_user_email() methods.

__abstractmethods__ = frozenset(['insert_data', 'setUpClass_method', 'tearDownClass_method', 'setUp_method', 'tearDown_method', 'clean_db'])
__dict__ = dict_proxy({'get_computer': <function get_computer>, 'insert_data': <function insert_data>, '__module__': 'aiida.backends.testimplbase', '__metaclass__': <class 'abc.ABCMeta'>, '_abc_negative_cache': <_weakrefset.WeakSet object>, 'clean_db': <function clean_db>, '_abc_registry': <_weakrefset.WeakSet object>, '__abstractmethods__': frozenset(['insert_data', 'setUpClass_method', 'tearDownClass_method', 'setUp_method', 'tearDown_method', 'clean_db']), 'get_user_email': <function get_user_email>, 'setUpClass_method': <function setUpClass_method>, '_abc_cache': <_weakrefset.WeakSet object>, 'tearDownClass_method': <function tearDownClass_method>, 'setUp_method': <function setUp_method>, 'tearDown_method': <function tearDown_method>, '__dict__': <attribute '__dict__' of 'AiidaTestImplementation' objects>, '_abc_negative_cache_version': 39, '__weakref__': <attribute '__weakref__' of 'AiidaTestImplementation' objects>, '__doc__': '\n For each implementation, define what to do at setUp and tearDown.\n\n Each subclass must reimplement two *standard* methods (i.e., *not* classmethods), called\n respectively ``setUpClass_method`` and ``tearDownClass_method``.\n It is also required to implement setUp_method and tearDown_method to be run for each single test\n They can set local properties (e.g. ``self.xxx = yyy``) but remember that ``xxx``\n is not visible to the upper (calling) Test class.\n\n Moreover, it is required that they define in the setUpClass_method the two properties:\n\n - ``self.computer`` that must be a Computer object\n - ``self.user_email`` that must be a string\n\n These two are then exposed by the ``self.get_computer()`` and ``self.get_user_email()``\n methods.\n '})
__metaclass__

alias of abc.ABCMeta

__module__ = 'aiida.backends.testimplbase'
__weakref__

list of weak references to the object (if defined)

_abc_cache = <_weakrefset.WeakSet object>
_abc_negative_cache = <_weakrefset.WeakSet object>
_abc_negative_cache_version = 39
_abc_registry = <_weakrefset.WeakSet object>
clean_db()[source]

This method implements the logic to fully clean the DB.

get_computer()[source]

A ORM Computer object present in the DB

get_user_email()[source]

A string with the email of the User

insert_data()[source]

This method inserts default data into the database.

setUpClass_method()[source]

This class prepares the database (cleans it up and installs some basic entries). You have also to set a self.computer and a self.user_email as explained in the docstring of the AiidaTestImplemention docstring.

setUp_method()[source]
tearDownClass_method()[source]

This class implements the tear down methods (e.g. cleans up the DB).

tearDown_method()[source]
aiida.backends.utils.QueryFactory()[source]
aiida.backends.utils._get_column(colname, alias)[source]

Return the column for a given projection. Needed by the QueryBuilder

aiida.backends.utils.del_global_setting(key)[source]
aiida.backends.utils.delete_nodes_and_connections(pks)[source]
aiida.backends.utils.get_authinfo(computer, aiidauser)[source]
aiida.backends.utils.get_automatic_user()[source]
aiida.backends.utils.get_backend_type()[source]

Set the schema version stored in the DB. Use only if you know what you are doing.

aiida.backends.utils.get_current_profile()[source]

Return, as a string, the current profile being used.

Return None if load_dbenv has not been loaded yet.

aiida.backends.utils.get_daemon_user()[source]
aiida.backends.utils.get_global_setting(key)[source]
aiida.backends.utils.get_global_setting_description(key)[source]
aiida.backends.utils.get_log_messages(*args, **kwargs)[source]
aiida.backends.utils.get_workflow_list(*args, **kwargs)[source]
aiida.backends.utils.is_dbenv_loaded()[source]

Return True of the dbenv was already loaded (with a call to load_dbenv), False otherwise.

aiida.backends.utils.load_dbenv(process=None, profile=None, *args, **kwargs)[source]
aiida.backends.utils.set_backend_type(backend_name)[source]

Set the schema version stored in the DB. Use only if you know what you are doing.

aiida.backends.utils.set_daemon_user(user_email)[source]
aiida.backends.utils.set_global_setting(key, value, description=None)[source]
aiida.backends.utils.validate_attribute_key(key)[source]

Validate the key string to check if it is valid (e.g., if it does not contain the separator symbol.).

Returns:None if the key is valid
Raises:ValidationError – if the key is not valid