Module that defines db models.
aiida.backends.djsite.db.models.
AiidaObjectManager
Bases: django.db.models.manager.Manager
django.db.models.manager.Manager
__module__
__slotnames__
get_queryset
Return a new QuerySet object. Subclasses can override this method to customize the behavior of the Manager.
AiidaQuerySet
Bases: django.db.models.query.QuerySet
django.db.models.query.QuerySet
Represent a lazy database lookup for a set of objects.
__getitem__
Get item for [] operator
Note: used to rely on the iterator in django 1.8 but does no longer in django 1.11.
__iter__
Iterate for list comprehensions.
iterator
An iterator over the results from applying this QuerySet to the database.
DbAuthInfo
Bases: django.db.models.base.Model
django.db.models.base.Model
Table that pairs aiida users and computers, with all required authentication information.
DoesNotExist
Bases: django.core.exceptions.ObjectDoesNotExist
django.core.exceptions.ObjectDoesNotExist
MultipleObjectsReturned
Bases: django.core.exceptions.MultipleObjectsReturned
django.core.exceptions.MultipleObjectsReturned
__str__
Return str(self).
_meta
aiidauser
Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.
In the example:
class Child(Model): parent = ForeignKey(Parent, related_name='children')
Child.parent is a ForwardManyToOneDescriptor instance.
Child.parent
ForwardManyToOneDescriptor
aiidauser_id
A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.
auth_params
dbcomputer
dbcomputer_id
enabled
id
metadata
objects
sa
alias of aldjemy.orm.DbAuthInfo
aldjemy.orm.DbAuthInfo
DbComment
Class to store comments.
content
ctime
dbnode
dbnode_id
get_next_by_ctime
get_next_by_mtime
get_previous_by_ctime
get_previous_by_mtime
mtime
alias of aldjemy.orm.DbComment
aldjemy.orm.DbComment
user
user_id
uuid
DbComputer
Table of computers or clusters.
Attributes: * name: A name to be used to refer to this computer. Must be unique. * hostname: Fully-qualified hostname of the host * transport_type: a string with a valid transport type
Note: other things that may be set in the metadata:
mpirun command num cores per node max num cores workdir: Full path of the aiida folder on the host. It can contain the string {username} that will be substituted by the username of the user on that machine. The actual workdir is then obtained as workdir.format(username=THE_ACTUAL_USERNAME) Example: workdir = “/scratch/{username}/aiida/” allocate full node = True or False … (further limits per user etc.)
mpirun command
num cores per node
max num cores
workdir: Full path of the aiida folder on the host. It can contain the string {username} that will be substituted by the username of the user on that machine. The actual workdir is then obtained as workdir.format(username=THE_ACTUAL_USERNAME) Example: workdir = “/scratch/{username}/aiida/”
allocate full node = True or False
… (further limits per user etc.)
dbauthinfo_set
Accessor to the related objects manager on the reverse side of a many-to-one relation.
Parent.children is a ReverseManyToOneDescriptor instance.
Parent.children
ReverseManyToOneDescriptor
Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.
create_forward_many_to_many_manager()
dbnodes
description
hostname
name
alias of aldjemy.orm.DbComputer
aldjemy.orm.DbComputer
scheduler_type
transport_type
DbGroup
A group of nodes.
Any group of nodes can be created, but some groups may have specific meaning if they satisfy specific rules (for instance, groups of UpdData objects are pseudopotential families - if no two pseudos are included for the same atomic element).
Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.
class Pizza(Model): toppings = ManyToManyField(Topping, related_name='pizzas')
Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.
Pizza.toppings
Topping.pizzas
ManyToManyDescriptor
extras
get_next_by_time
get_previous_by_time
label
alias of aldjemy.orm.DbGroup
aldjemy.orm.DbGroup
time
type_string
DbLink
Direct connection between two dbnodes. The label is identifying thelink type.
input
input_id
output
output_id
alias of aldjemy.orm.DbLink
aldjemy.orm.DbLink
type
DbLog
Class to store logs.
levelname
loggername
message
alias of aldjemy.orm.DbLog
aldjemy.orm.DbLog
DbNode
Generic node: data or calculation or code.
Nodes can be linked (DbLink table) Naming convention for Node relationships: A –> C –> B.
A is ‘input’ of C.
C is ‘output’ of A.
Internal attributes, that define the node itself, are stored in the DbAttribute table; further user-defined attributes, called ‘extra’, are stored in the DbExtra table (same schema and methods of the DbAttribute table, but the code does not rely on the content of the table, therefore the user can use it at his will to tag or annotate nodes.
Attributes in the DbAttribute table have to be thought as belonging to the DbNode, (this is the reason for which there is no ‘user’ field in the DbAttribute field). Moreover, Attributes define uniquely the Node so should be immutable.
aiidaobjects
attributes
dbcomments
dbgroups
dblogs
get_simple_name
Return a string with the last part of the type name.
If the type is empty, use ‘Node’. If the type is invalid, return the content of the input variable invalid_result.
invalid_result
invalid_result – The value to be returned if the node type is not recognized.
input_links
inputs
node_type
output_links
outputs
process_type
alias of aldjemy.orm.DbNode
aldjemy.orm.DbNode
DbSetting
This will store generic settings that should be database-wide.
del_value
Set a setting value.
get_description
This can be called on a given row and will get the corresponding description.
getvalue
This can be called on a given row and will get the corresponding value.
key
alias of aldjemy.orm.DbSetting
aldjemy.orm.DbSetting
set_value
Delete a setting value.
val
DbUser
Class that represents a user as the owner of a specific Node.
REQUIRED_FIELDS
USERNAME_FIELD
dbcomment_set
email
first_name
institution
is_anonymous
is_authenticated
last_name
alias of aldjemy.orm.DbUser
aldjemy.orm.DbUser
suppress_auto_now
This context manager disables the auto_now & editable flags for the fields of the given models. This is useful when we would like to update the datetime fields of an entry bypassing the automatic set of the date (with the current time). This is very useful when entries are imported and we would like to keep e.g. the modification time that we set during the import and not allow Django to set it to the datetime that corresponds to when the entry was saved. In the end the flags are returned to their original value. :param list_of_models_fields: A list of (model, fields) tuples for which the flags will be updated. The model is an object that corresponds to the model objects and fields is a list of strings with the field names.
Base class for AiiDA tests
aiida.backends.djsite.db.testbase.
DjangoTests
Bases: aiida.backends.testimplbase.AiidaTestImplementation
aiida.backends.testimplbase.AiidaTestImplementation
Automatically takes care of the setUpClass and TearDownClass, when needed.
__abstractmethods__
_abc_impl
clean_db
This method fully cleans the DB.