aiida.manage package¶
Managing an AiiDA instance:
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
Subpackages¶
Submodules¶
Definition of caching mechanism and configuration for calculations.
-
aiida.manage.caching.
get_use_cache
(node_class=None, identifier=None)[source]¶ Return whether the caching mechanism should be used for the given entry point according to the configuration.
- Parameters
node_class – the Node class or sub class to check if enabled for caching
identifier – the full entry point string of the process, e.g. aiida.calculations:arithmetic.add
- Returns
boolean, True if caching is enabled, False otherwise
- Raises
ValueError – if the configuration is invalid by defining the class both enabled and disabled
-
aiida.manage.caching.
enable_caching
(node_class=None, identifier=None)[source]¶ Context manager to enable caching, either for a specific node class, or globally.
Warning
this does not affect the behavior of the daemon, only the local Python interpreter.
- Parameters
node_class – Node class for which caching should be enabled.
identifier – the full entry point string of the process, e.g. aiida.calculations:arithmetic.add
-
aiida.manage.caching.
disable_caching
(node_class=None, identifier=None)[source]¶ 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.
- Parameters
node_class – Node class for which caching should be disabled.
identifier – the full entry point string of the process, e.g. aiida.calculations:arithmetic.add
Testing infrastructure for easy testing of AiiDA plugins.
-
aiida.manage.fixtures.
FixtureManager
¶ alias of
aiida.manage.tests.TestManager
-
aiida.manage.fixtures.
fixture_manager
(backend='django', profile_name=None, pgtest=None)¶ 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
- Parameters
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.
-
class
aiida.manage.fixtures.
PluginTestCase
(methodName='runTest')[source]¶ Bases:
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.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__
= 'aiida.manage.tests.unittest_classes'¶
-
backend
= None¶
-
AiiDA manager for global settings