aiida.restapi.translator package¶
Subpackages¶
Submodules¶
-
class
aiida.restapi.translator.base.
BaseTranslator
(Class=None, **kwargs)[source]¶ Bases:
object
Generic class for translator. It contains the methods required to build a related QueryBuilder object
-
__dict__
= dict_proxy({'get_results': <function get_results>, 'set_query': <function set_query>, '_is_qb_initialized': False, '_aiida_type': None, 'set_order': <function set_order>, '__module__': 'aiida.restapi.translator.base', '_is_id_query': None, '__label__': None, '_result_type': None, '__dict__': <attribute '__dict__' of 'BaseTranslator' objects>, '__weakref__': <attribute '__weakref__' of 'BaseTranslator' objects>, '_qb_type': None, '__init__': <function __init__>, 'count': <function count>, '_aiida_class': None, 'get_schema': <function get_schema>, 'set_filters': <function set_filters>, '_default_projections': [], 'set_default_projections': <function set_default_projections>, 'get_total_count': <function get_total_count>, 'get_default_projections': <function get_default_projections>, 'get_formatted_result': <function get_formatted_result>, 'set_limit_offset': <function set_limit_offset>, '_total_count': None, '_has_uuid': None, '_check_id_validity': <function _check_id_validity>, 'init_qb': <function init_qb>, 'set_projections': <function set_projections>, '_default': [], 'get_query_help': <function get_query_help>, '__doc__': '\n Generic class for translator. It contains the methods\n required to build a related QueryBuilder object\n ', '__repr__': <function __repr__>})¶
-
__init__
(Class=None, **kwargs)[source]¶ Initialise the parameters. Create the basic query_help
keyword Class (default None but becomes this class): is the class from which one takes the initial values of the attributes. By default is this class so that class atributes are translated into object attributes. In case of inheritance one cane use the same constructore but pass the inheriting class to pass its attributes.
-
__label__
= None¶
-
__module__
= 'aiida.restapi.translator.base'¶
-
__repr__
()[source]¶ This function is required for the caching system to be able to compare two NodeTranslator objects. Comparison is done on the value returned by __repr__
Returns: representation of NodeTranslator objects. Returns nothing because the inputs of self.get_nodes are sufficient to determine the identity of two queries.
-
__weakref__
¶ list of weak references to the object (if defined)
-
_aiida_class
= None¶
-
_aiida_type
= None¶
-
_check_id_validity
(id)[source]¶ Checks whether id corresponds to an object of the expected type, whenever type is a valid column of the database (ex. for nodes, but not for users)
Parameters: id – id (or id starting pattern) Returns: True if id valid, False if invalid. If True, sets the id filter attribute correctly Raises: RestValidationError – if no node is found or id pattern does not identify a unique node
-
_default
= []¶
-
_default_projections
= []¶
-
_has_uuid
= None¶
-
_is_id_query
= None¶
-
_is_qb_initialized
= False¶
-
_qb_type
= None¶
-
_result_type
= None¶
-
_total_count
= None¶
-
get_default_projections
()[source]¶ method to get default projections of the node :return: self._default_projections
-
get_formatted_result
(label)[source]¶ Runs the query and retrieves results tagged as “label”.
Parameters: label (str) – the tag of the results to be extracted out of the query rows. Returns: a list of the query results
-
get_results
()[source]¶ Returns either list of nodes or details of single node from database.
Returns: either list of nodes or details of single node from database
-
set_default_projections
()[source]¶ It calls the set_projections() methods internally to add the default projections in query_help
Returns: None
-
set_filters
(filters={})[source]¶ Add filters in query_help.
Parameters: filters – it is a dictionary where keys are the tag names given in the path in query_help and their values are the dictionary of filters want to add for that tag name. Format for the Filters dictionary:
filters = { "tag1" : {k1:v1, k2:v2}, "tag2" : {k1:v1, k2:v2}, }
Returns: query_help dict including filters if any.
-
set_limit_offset
(limit=None, offset=None)[source]¶ sets limits and offset directly to the query_builder object
Parameters: - limit –
- offset –
Returns:
-
set_order
(orders)[source]¶ Add order_by clause in query_help :param orders: dictionary of orders you want to apply on final results :return: None or exception if any.
-
set_projections
(projections)[source]¶ add the projections in query_help
Parameters: projections – it is a dictionary where keys are the tag names given in the path in query_help and values are the list of the names you want to project in the final output Returns: updated query_help with projections
-
set_query
(filters=None, orders=None, projections=None, id=None)[source]¶ Adds filters, default projections, order specs to the query_help, and initializes the qb object
Parameters: - filters – dictionary with the filters
- orders – dictionary with the order for each tag
- orders – dictionary with the projections
- id (int) – id of a specific node
-
-
class
aiida.restapi.translator.code.
CodeTranslator
(**kwargs)[source]¶ Bases:
aiida.restapi.translator.node.NodeTranslator
Translator relative to resource ‘codes’ and aiida class Code
-
class
Code
(**kwargs)¶ Bases:
aiida.orm.implementation.general.code.AbstractCode
-
__abstractmethods__
= frozenset([])¶
-
__module__
= 'aiida.orm.implementation.django.code'¶
-
_abc_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache_version
= 38¶
-
_abc_registry
= <_weakrefset.WeakSet object>¶
-
_logger
= <logging.Logger object>¶
-
_plugin_type_string
= 'code.Code.'¶
-
_query_type_string
= 'code.'¶
-
_set_local
()¶ Set the code as a ‘local’ code, meaning that all the files belonging to the code will be copied to the cluster, and the file set with set_exec_filename will be run.
It also deletes the flags related to the local case (if any)
-
can_run_on
(computer)¶ Return True if this code can run on the given computer, False otherwise.
Local codes can run on any machine; remote codes can run only on the machine on which they reside.
TODO: add filters to mask the remote machines on which a local code can run.
-
classmethod
get
(pk=None, label=None, machinename=None)¶ Get a Computer object with given identifier string, that can either be the numeric ID (pk), or the label (and computername) (if unique).
Parameters: - pk – the numeric ID (pk) for code
- label – the code label identifying the code to load
- machinename – the machine name where code is setup
Raises: - NotExistent – if no code identified by the given string is found
- MultipleObjectsError – if the string cannot identify uniquely a code
- InputValidationError – if neither a pk nor a label was passed in
-
classmethod
get_from_string
(code_string)¶ Get a Computer object with given identifier string in the format label@machinename. See the note below for details on the string detection algorithm.
Note
the (leftmost) ‘@’ symbol is always used to split code and computername. Therefore do not use ‘@’ in the code name if you want to use this function (‘@’ in the computer name are instead valid).
Parameters: code_string – the code string identifying the code to load
Raises: - NotExistent – if no code identified by the given string is found
- MultipleObjectsError – if the string cannot identify uniquely a code
- InputValidationError – if code_string is not of string type
-
classmethod
list_for_plugin
(plugin, labels=True)¶ Return a list of valid code strings for a given plugin.
Parameters: - plugin – The string of the plugin.
- labels – if True, return a list of code names, otherwise return the code PKs (integers).
Returns: a list of string, with the code names if labels is True, otherwise a list of integers with the code PKs.
-
set_remote_computer_exec
(remote_computer_exec)¶ Set the code as remote, and pass the computer on which it resides and the absolute path on that computer.
- Args:
- remote_computer_exec: a tuple (computer, remote_exec_path), where
- computer is a aiida.orm.Computer or an aiida.backends.djsite.db.models.DbComputer object, and remote_exec_path is the absolute path of the main executable on remote computer.
-
-
__label__
= 'codes'¶
-
__module__
= 'aiida.restapi.translator.code'¶
-
_aiida_class
¶
-
_aiida_type
= 'code.Code'¶
-
_qb_type
= 'code.Code.'¶
-
_result_type
= 'codes'¶
-
class
-
class
aiida.restapi.translator.computer.
ComputerTranslator
(**kwargs)[source]¶ Bases:
aiida.restapi.translator.base.BaseTranslator
Translator relative to resource ‘computers’ and aiida class Computer
-
class
Computer
(**kwargs)¶ Bases:
aiida.orm.implementation.general.computer.AbstractComputer
-
__init__
(**kwargs)¶ x.__init__(…) initializes x; see help(type(x)) for signature
-
__module__
= 'aiida.orm.implementation.django.computer'¶
-
_get_metadata
()¶
-
_set_metadata
(metadata_dict)¶ Set the metadata.
-
copy
()¶ Return a copy of the current object to work with, not stored yet.
-
dbcomputer
¶
-
description
¶
-
full_text_info
¶
-
classmethod
get
(computer)¶ Return a computer from its name (or from another Computer or DbComputer instance)
-
get_calculations_on_computer
()¶
-
static
get_db_columns
()¶
-
get_dbauthinfo
(user)¶ Return the aiida.backends.djsite.db.models.DbAuthInfo instance for the given user on this computer, if the computer is not configured for the given user.
Parameters: user – a DbUser instance. Returns: a aiida.backends.djsite.db.models.DbAuthInfo instance Raises: NotExistent – if the computer is not configured for the given user.
-
get_description
()¶
-
get_hostname
()¶
-
get_name
()¶
-
get_scheduler_type
()¶
-
get_shebang
()¶
-
get_transport_params
()¶
-
get_transport_type
()¶
-
get_workdir
()¶
-
hostname
¶
-
id
¶
-
is_enabled
()¶
-
is_user_configured
(user)¶ Return True if the computer is configured for the given user, False otherwise.
Parameters: user – a DbUser instance. Returns: a boolean.
-
is_user_enabled
(user)¶ Return True if the computer is enabled for the given user (looking only at the per-user setting: the computer could still be globally disabled).
Note: Return False also if the user is not configured for the computer. Parameters: user – a DbUser instance. Returns: a boolean.
-
classmethod
list_names
()¶ Return a list with all the names of the computers in the DB.
-
name
¶
-
pk
¶
-
set
(**kwargs)¶
-
set_description
(val)¶
-
set_enabled_state
(enabled)¶
-
set_hostname
(val)¶
-
set_name
(val)¶
-
set_scheduler_type
(val)¶
-
set_transport_params
(val)¶
-
set_transport_type
(val)¶
-
set_workdir
(val)¶
-
store
()¶ Store the computer in the DB.
Differently from Nodes, a computer can be re-stored if its properties are to be changed (e.g. a new mpirun command, etc.)
-
to_be_stored
¶
-
uuid
¶
-
-
__label__
= 'computers'¶
-
__module__
= 'aiida.restapi.translator.computer'¶
-
_aiida_class
¶
-
_aiida_type
= 'computer.Computer'¶
-
_default_projections
= [u'id', u'name', u'hostname', u'description', u'enabled', u'scheduler_type', u'transport_type', u'transport_params', u'uuid']¶
-
_has_uuid
= True¶
-
_qb_type
= 'computer'¶
-
_result_type
= 'computers'¶
-
class
-
class
aiida.restapi.translator.group.
GroupTranslator
(**kwargs)[source]¶ Bases:
aiida.restapi.translator.base.BaseTranslator
Translator relative to resource ‘groups’ and aiida class Group
-
class
Group
(**kwargs)¶ Bases:
aiida.orm.implementation.general.group.AbstractGroup
-
__abstractmethods__
= frozenset([])¶
-
__init__
(**kwargs)¶ Create a new group. Either pass a dbgroup parameter, to reload ad group from the DB (and then, no further parameters are allowed), or pass the parameters for the Group creation.
Parameters: - dbgroup – the dbgroup object, if you want to reload the group from the DB rather than creating a new one.
- name – The group name, required on creation
- description – The group description (by default, an empty string)
- user – The owner of the group (by default, the automatic user)
- type_string – a string identifying the type of group (by default, an empty string, indicating an user-defined group.
-
__int__
()¶ Convert the class to an integer. This is needed to allow querying with Django. Be careful, though, not to pass it to a wrong field! This only returns the local DB principal key (pk) value.
Returns: the integer pk of the node or None if not stored.
-
__module__
= 'aiida.orm.implementation.django.group'¶
-
_abc_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache_version
= 38¶
-
_abc_registry
= <_weakrefset.WeakSet object>¶
-
add_nodes
(nodes)¶ Add a node or a set of nodes to the group.
Note: The group must be already stored. Note: each of the nodes passed to add_nodes must be already stored. Parameters: nodes – a Node or DbNode object to add to the group, or a list of Nodes or DbNodes to add.
-
dbgroup
¶
-
delete
()¶ Delete the group from the DB
-
description
¶
-
static
get_db_columns
()¶
-
id
¶
-
is_stored
¶
-
name
¶
-
nodes
¶
-
pk
¶
-
classmethod
query
(name=None, type_string='', pk=None, uuid=None, nodes=None, user=None, node_attributes=None, past_days=None, name_filters=None, **kwargs)¶ Query for groups.
Note: By default, query for user-defined groups only (type_string==”“). If you want to query for all type of groups, pass type_string=None. If you want to query for a specific type of groups, pass a specific string as the type_string argument.
Parameters: - name – the name of the group
- nodes – a node or list of nodes that belongs to the group (alternatively, you can also pass a DbNode or list of DbNodes)
- pk – the pk of the group
- uuid – the uuid of the group
- type_string – the string for the type of node; by default, look only for user-defined groups (see note above).
- user – by default, query for groups of all users; if specified, must be a DbUser object, or a string for the user email.
- past_days – by default, query for all groups; if specified, query the groups created in the last past_days. Must be a datetime object.
- node_attributes – if not None, must be a dictionary with format {k: v}. It will filter and return only groups where there is at least a node with an attribute with key=k and value=v. Different keys of the dictionary are joined with AND (that is, the group should satisfy all requirements. v can be a base data type (str, bool, int, float, …) If it is a list or iterable, that the condition is checked so that there should be at least a node in the group with key=k and value=each of the values of the iterable.
- kwargs –
any other filter to be passed to DbGroup.objects.filter
- Example: if
node_attributes = {'elements': ['Ba', 'Ti'], 'md5sum': 'xxx'}
, - it will find groups that contain the node with md5sum = ‘xxx’, and moreover contain at least one node for element ‘Ba’ and one node for element ‘Ti’.
- Example: if
-
remove_nodes
(nodes)¶ Remove a node or a set of nodes to the group.
Note: The group must be already stored. Note: each of the nodes passed to add_nodes must be already stored. Parameters: nodes – a Node or DbNode object to add to the group, or a list of Nodes or DbNodes to add.
-
store
()¶
-
type_string
¶
-
user
¶
-
uuid
¶
-
-
__label__
= 'groups'¶
-
__module__
= 'aiida.restapi.translator.group'¶
-
_aiida_class
¶
-
_aiida_type
= 'group.Group'¶
-
_default_projections
= [u'id', u'name', u'type', u'description', u'user_id', u'user_email', u'uuid']¶
-
_has_uuid
= True¶
-
_qb_type
= 'group'¶
-
_result_type
= 'groups'¶
-
class
-
class
aiida.restapi.translator.node.
NodeTranslator
(Class=None, **kwargs)[source]¶ Bases:
aiida.restapi.translator.base.BaseTranslator
Translator relative to resource ‘nodes’ and aiida class Node
-
class
Node
(**kwargs)¶ Bases:
aiida.orm.implementation.general.node.AbstractNode
-
__abstractmethods__
= frozenset([])¶
-
__init__
(**kwargs)¶ Initialize the object Node.
Parameters: uuid – if present, the Node with given uuid is loaded from the database. (It is not possible to assign a uuid to a new Node.)
-
__module__
= 'aiida.orm.implementation.django.node'¶
-
_abc_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache_version
= 38¶
-
_abc_registry
= <_weakrefset.WeakSet object>¶
-
_add_dblink_from
(src, label=None, link_type=<LinkType.UNSPECIFIED: 'unspecified'>)¶ Add a link to the current node from the ‘src’ node. Both nodes must be a Node instance (or a subclass of Node)
Note: this function should not be called directly; it acts directly on the database.
Parameters: - src – the source object
- label (str) – the name of the label to set the link from src. Default = None.
-
_db_attrs
()¶ Returns the keys of the attributes as a generator, directly from the DB.
DO NOT USE DIRECTLY.
-
_db_iterattrs
()¶ Iterator over the attributes (directly in the DB!)
DO NOT USE DIRECTLY.
-
_db_iterextras
()¶ Iterator over the extras (directly in the DB!)
DO NOT USE DIRECTLY.
-
_db_store
(with_transaction=True)¶ Store a new node in the DB, also saving its repository directory and attributes.
After being called attributes cannot be changed anymore! Instead, extras can be changed only AFTER calling this store() function.
Note: After successful storage, those links that are in the cache, and for which also the parent node is already stored, will be automatically stored. The others will remain unstored.
Parameters: - with_transaction – if False, no transaction is used. This is meant to be used ONLY if the outer calling function has already a transaction open!
- use_cache (bool) – Whether I attempt to find an equal node in the DB.
-
_db_store_all
(with_transaction=True, use_cache=None)¶ Store the node, together with all input links, if cached, and also the linked nodes, if they were not stored yet.
Parameters: with_transaction – if False, no transaction is used. This is meant to be used ONLY if the outer calling function has already a transaction open!
-
_del_db_attr
(key)¶ Delete an attribute directly from the DB
DO NOT USE DIRECTLY.
Parameters: key – The key of the attribute to delete
-
_del_db_extra
(key)¶ Delete an extra, directly on the DB.
DO NOT USE DIRECTLY.
Parameters: key – key name
-
_do_create_link
(src, label, link_type)¶
-
_get_db_attr
(key)¶ Return the attribute value, directly from the DB.
DO NOT USE DIRECTLY.
Parameters: key – the attribute key Returns: the attribute value Raises: AttributeError – if the attribute does not exist.
-
_get_db_description_field
()¶ Get the description of this node, acting directly at the DB level
-
_get_db_extra
(key, *args)¶ Get an extra, directly from the DB.
DO NOT USE DIRECTLY.
Parameters: key – key name Returns: the key value Raises: AttributeError – if the key does not exist
-
_get_db_input_links
(link_type)¶ Return a list of tuples (label, aiida_class) for each input link, possibly filtering only by those of a given type.
Parameters: link_type – if not None, a link type to filter results Returns: a list of tuples (label, aiida_class)
-
_get_db_label_field
()¶ Get the label field acting directly on the DB
Returns: a string.
-
_get_db_output_links
(link_type)¶ Return a list of tuples (label, aiida_class) for each output link, possibly filtering only by those of a given type.
Parameters: link_type – if not None, a link type to filter results Returns: a list of tuples (label, aiida_class)
-
_get_dbcomments
(pk=None)¶ Return a sorted list of DbComment associated with the Node.
Parameters: pk – integer or list of integers. If it is specified, returns the comment values with desired pks. (pk refers to DbComment.pk) Returns: the list of DbComment, sorted by pk.
-
_increment_version_number_db
()¶ This function increments the version number in the DB. This should be called every time you need to increment the version (e.g. on adding a extra or attribute).
Note: Do not manually increment the version number, because if two different threads are adding/changing an attribute concurrently, the version number would be incremented only once.
-
_logger
= <logging.Logger object>¶
-
_plugin_type_string
= ''¶
-
_query_type_string
= ''¶
-
_remove_comment
(comment_pk, user)¶ Function called by verdi comment remove
-
_remove_dblink_from
(label)¶ Remove from the DB the input link with the given label.
Note: this function should not be called directly; it acts directly on the database.
Note: No checks are done to verify that the link actually exists.
Parameters: - label (str) – the label of the link from src to the current Node
- link_type – The type of link, must be one of the enum values form
LinkType
-
_replace_dblink_from
(src, label, link_type)¶ Replace an input link with the given label and type, or simply creates it if it does not exist.
Note: this function should not be called directly; it acts directly on the database.
Parameters: - src (str) – the source object.
- label (str) – the label of the link from src to the current Node
- link_type – The type of link, must be one of the enum values form
LinkType
-
_reset_db_extras
(new_extras)¶ Resets the extras (replacing existing ones) directly in the DB
DO NOT USE DIRECTLY!
Parameters: new_extras – dictionary with new extras
-
_set_db_attr
(key, value)¶ Set the value directly in the DB, without checking if it is stored, or using the cache.
DO NOT USE DIRECTLY.
Parameters: - key (str) – key name
- value – its value
-
_set_db_computer
(computer)¶ Set the computer directly inside the dbnode member, in the DB.
DO NOT USE DIRECTLY.
Parameters: computer – the computer object
-
_set_db_extra
(key, value, exclusive=False)¶ Store extra directly in the DB, without checks.
DO NOT USE DIRECTLY.
Parameters: - key – key name
- value – key value
- exclusive – (default=False). If exclusive is True, it raises a UniquenessError if an Extra with the same name already exists in the DB (useful e.g. to “lock” a node and avoid to run multiple times the same computation on it).
-
_store_cached_input_links
(with_transaction=True)¶ Store all input links that are in the local cache, transferring them to the DB.
Note: This can be called only if all parents are already stored. Note: Links are stored only after the input nodes are stored. Moreover, link storage is done in a transaction, and if one of the links cannot be stored, an exception is raised and all links will remain in the cache. Note: This function can be called only after the node is stored. After that, it can be called multiple times, and nothing will be executed if no links are still in the cache. Parameters: with_transaction – if False, no transaction is used. This is meant to be used ONLY if the outer calling function has already a transaction open!
-
_update_comment
(new_field, comment_pk, user)¶ Function called by verdi comment update
-
_update_db_description_field
(field_value)¶ Update the description of this node, acting directly at the DB level
-
_update_db_label_field
(field_value)¶ Set the label field acting directly on the DB
-
add_comment
(content, user=None)¶ Add a new comment.
Parameters: content – string with comment
-
copy
(**kwargs)¶ Return a copy of the current object to work with, not stored yet.
This is a completely new entry in the DB, with its own UUID. Works both on stored instances and with not-stored ones.
Copies files and attributes, but not the extras. Does not store the Node to allow modification of attributes.
Returns: an object copy
-
ctime
¶
-
dbnode
¶
-
get_comment_obj
(id=None, user=None)¶
-
get_comments
(pk=None)¶ Return a sorted list of comment values, one for each comment associated to the node.
Parameters: pk – integer or list of integers. If it is specified, returns the comment values with desired pks. (pk refers to DbComment.pk) Returns: the list of comments, sorted by pk; each element of the list is a dictionary, containing (pk, email, ctime, mtime, content)
-
get_computer
()¶ Get the computer associated to the node.
Returns: the Computer object or None.
-
static
get_db_columns
()¶
-
classmethod
get_subclass_from_pk
(pk)¶ Get a node object from the pk, with the proper subclass of Node. (integer primary key used in this database), but loading the proper subclass where appropriate.
Parameters: pk – a string with the pk of the object to be loaded. Returns: the object of the proper subclass. Raise: NotExistent: if there is no entry of the desired object kind with the given pk.
-
classmethod
get_subclass_from_uuid
(uuid)¶ Get a node object from the uuid, with the proper subclass of Node. (if Node(uuid=…) is called, only the Node class is loaded).
Parameters: uuid – a string with the uuid of the object to be loaded. Returns: the object of the proper subclass. Raise: NotExistent: if there is no entry of the desired object kind with the given uuid.
-
get_user
()¶ Get the user.
Returns: a DbUser model object
-
id
¶
-
mtime
¶
-
classmethod
query
(*args, **kwargs)¶ Map to the aiidaobjects manager of the DbNode, that returns Node objects (or their subclasses) instead of DbNode entities.
# TODO: VERY IMPORTANT: the recognition of a subclass from the type # does not work if the modules defining the subclasses are not # put in subfolders. # In the future, fix it either to make a cache and to store the # full dependency tree, or save also the path.
-
type
¶
-
uuid
¶
-
-
__label__
= 'nodes'¶
-
__module__
= 'aiida.restapi.translator.node'¶
-
_aiida_class
¶
-
_aiida_type
= 'node.Node'¶
-
_alist
= None¶
-
_content_type
= None¶
-
_downloadformat
= None¶
-
_elist
= None¶
-
_filename
= None¶
-
_get_content
()[source]¶ Used by get_results() in case of endpoint include “content” option :return: data: a dictionary containing the results obtained by running the query
-
_get_subclasses
(parent=None, parent_class=None, recursive=True)[source]¶ Import all submodules of the package containing the present class.
Includes subpackages recursively, if specified.
Parameters: - parent – package/class. If package looks for the classes in submodules. If class, first lookss for the package where it is contained
- parent_class – class of which to look for subclasses
- recursive – True/False (go recursively into submodules)
-
_has_uuid
= True¶
-
_nalist
= None¶
-
_nelist
= None¶
-
_qb_type
= 'node.Node.'¶
-
_result_type
= 'nodes'¶
-
_rtype
= None¶
-
_visformat
= None¶
-
get_downloadable_data
(node, format=None)[source]¶ Generic function to download file in specified format. Actual definition is in child classes as the content to be returned and its format depends on the visualization plugin specific to the resource
Parameters: - node – node object
- format – file extension format
Returns: data in selected format to download
-
static
get_file_content
(file_name)[source]¶ It reads the file from directory and returns its content.
Instead of using “send_from_directory” from flask, this method is written because in next aiida releases the file can be stored locally or in object storage.
Parameters: - node – aiida folderData node which contains file
- file_name – name of the file to return its contents
Returns:
-
get_results
()[source]¶ Returns either a list of nodes or details of single node from database
Returns: either a list of nodes or the details of single node from the database
-
get_retrieved_inputs
(node, filename=None, rtype=None)[source]¶ Generic function to return output of calc inputls verdi command. Actual definition is in child classes as the content to be returned and its format depends on the visualization plugin specific to the resource
Parameters: node – node object Returns: list of calc inputls command
-
get_retrieved_outputs
(node, filename=None, rtype=None)[source]¶ Generic function to return output of calc outputls verdi command. Actual definition is in child classes as the content to be returned and its format depends on the visualization plugin specific to the resource
Parameters: node – node object Returns: list of calc outputls command
-
get_visualization_data
(node, format=None)[source]¶ Generic function to get the data required to visualize the node with a specific plugin. Actual definition is in child classes as the content to be be returned and its format depends on the visualization plugin specific to the resource
Parameters: node – node object that has to be visualized Returns: data selected and serializaed for visualization
-
set_query
(filters=None, orders=None, projections=None, query_type=None, id=None, alist=None, nalist=None, elist=None, nelist=None, downloadformat=None, visformat=None, filename=None, rtype=None)[source]¶ Adds filters, default projections, order specs to the query_help, and initializes the qb object
Parameters: - filters – dictionary with the filters
- orders – dictionary with the order for each tag
- projections – dictionary with the projection. It is discarded if query_type==’attributes’/’extras’
- query_type – (string) specify the result or the content (“attr”)
- id – (integer) id of a specific node
-
set_query_type
(query_type, alist=None, nalist=None, elist=None, nelist=None, downloadformat=None, visformat=None, filename=None, rtype=None)[source]¶ sets one of the mutually exclusive values for self._result_type and self._content_type.
:param query_type:(string) the value assigned to either variable.
-
class
-
class
aiida.restapi.translator.user.
UserTranslator
(**kwargs)[source]¶ Bases:
aiida.restapi.translator.base.BaseTranslator
Translator relative to resource ‘users’ and aiida class User
-
class
User
(**kwargs)¶ Bases:
aiida.orm.implementation.general.user.AbstractUser
-
__abstractmethods__
= frozenset([])¶
-
__init__
(**kwargs)¶ x.__init__(…) initializes x; see help(type(x)) for signature
-
__int__
()¶
-
__module__
= 'aiida.orm.implementation.django.user'¶
-
_abc_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache
= <_weakrefset.WeakSet object>¶
-
_abc_negative_cache_version
= 38¶
-
_abc_registry
= <_weakrefset.WeakSet object>¶
-
_get_password
()¶
-
_set_password
(val)¶
-
date_joined
¶
-
email
¶
-
first_name
¶
-
force_save
()¶
-
static
get_db_columns
()¶
-
id
¶
-
institution
¶
-
is_active
¶
-
is_staff
¶
-
is_superuser
¶
-
last_login
¶
-
last_name
¶
-
pk
¶
-
save
()¶
-
classmethod
search_for_users
(**kwargs)¶ Search for a user the passed keys.
Parameters: kwargs – The keys to search for the user with. Returns: A list of users matching the search criteria.
-
to_be_stored
¶
-
-
__label__
= 'users'¶
-
__module__
= 'aiida.restapi.translator.user'¶
-
_aiida_class
¶
-
_aiida_type
= 'user.User'¶
-
_default_projections
= [u'id', u'first_name', u'last_name', u'email', u'institution', u'date_joined', u'last_login', u'is_active']¶
-
_has_uuid
= False¶
-
_qb_type
= 'user'¶
-
_result_type
= 'users'¶
-
class