Managing an AiiDA instance:
configuration file profiles databases repositories external components (such as Postgres, RabbitMQ)
configuration file
profiles
databases
repositories
external components (such as Postgres, RabbitMQ)
Note
Modules in this sub package may require the database environment to be loaded
Definition of caching mechanism and configuration for calculations.
aiida.manage.caching.
disable_caching
Context manager to disable caching, either for a specific node class, or globally.
Warning
this does not affect the behavior of the daemon, only the local Python interpreter.
identifier (str) – Process type string of the node, or a pattern with ‘*’ wildcard that matches it. If not provided, caching is disabled for all classes.
enable_caching
Context manager to enable caching, either for a specific node class, or globally.
identifier (str) – Process type string of the node, or a pattern with ‘*’ wildcard that matches it. If not provided, caching is enabled for all classes.
get_use_cache
Return whether the caching mechanism should be used for the given process type according to the configuration.
identifier (str) – Process type string of the node
boolean, True if caching is enabled, False otherwise
~aiida.common.exceptions.ConfigurationError if the configuration is invalid, either due to a general configuration error, or by defining the class both enabled and disabled
Testing infrastructure for easy testing of AiiDA plugins.
aiida.manage.fixtures.
FixtureManager
alias of aiida.manage.tests.TestManager
aiida.manage.tests.TestManager
PluginTestCase
Bases: unittest.case.TestCase
unittest.case.TestCase
Set up a complete temporary AiiDA environment for plugin tests.
Note: This test class needs to be run through the TestRunner and will not work simply with python -m unittest discover.
TestRunner
Usage example:
MyTestCase(aiida.manage.tests.unittest_classes.PluginTestCase): def setUp(self): # load my tests data # optionally extend setUpClass / tearDownClass / tearDown if needed def test_my_plugin(self): # execute tests
__module__
backend
setUpClass
Hook method for setting up class fixture before running tests in the class.
tearDown
Hook method for deconstructing the test fixture after testing it.
fixture_manager
Context manager for TestManager objects.
Sets up temporary AiiDA environment for testing or reuses existing environment, if AIIDA_TEST_PROFILE environment variable is set.
Example pytest fixture:
def aiida_profile(): with test_manager(backend) as test_mgr: yield fixture_mgr
Example unittest test runner:
with test_manager(backend) as test_mgr: # ready for tests # everything cleaned up
backend – database backend, either BACKEND_SQLA or BACKEND_DJANGO
profile_name – name of test profile to be used or None (to use temporary profile)
pgtest – a dictionary of arguments to be passed to PGTest() for starting the postgresql cluster, e.g. {‘pg_ctl’: ‘/somepath/pg_ctl’}. Should usually not be necessary.
AiiDA manager for global settings
aiida.manage.manager.
get_manager
reset_manager