aiida.restapi.translator.nodes package

Submodules

Translator for node

class aiida.restapi.translator.nodes.node.NodeTranslator(Class=None, **kwargs)[source]

Bases: aiida.restapi.translator.base.BaseTranslator

Translator relative to resource ‘nodes’ and aiida class Node

__init__(Class=None, **kwargs)[source]

Initialise the parameters. Create the basic query_help

__label__ = 'nodes'
__module__ = 'aiida.restapi.translator.nodes.node'
_aiida_class

alias of aiida.orm.nodes.node.Node

_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 looks 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
_result_type = 'nodes'
_rtype = None
_visformat = None
get_downloadable_data(node, download_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

  • download_format – file extension format

Returns

data in selected format to download

If this method is called by Node resource it will look for the type of object and invoke the correct method in the lowest-compatible subclass

static get_file_content(node, 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_io_tree(uuid_pattern, tree_in_limit, tree_out_limit)[source]

json data to display nodes in tree format :param uuid_pattern: main node uuid :return: json data to display node tree

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

static 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

static 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_statistics(user_pk=None)[source]

Return statistics for a given node

get_types()[source]

return available distinct types of nodes from database

get_visualization_data(node, visformat=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

  • visformat – visualization format

Returns

data selected and serialized for visualization

If this method is called by Node resource it will look for the type of object and invoke the correct method in the lowest-compatible subclass

set_query(filters=None, orders=None, projections=None, query_type=None, node_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

  • alist – list of attributes queried for node

  • nalist – list of attributes, returns all attributes except this for node

  • elist – list of extras queries for node

  • nelist – list of extras, returns all extras except this for node

  • downloadformat – file format to download e.g. cif, xyz

  • visformat – data format to visualise the node. Mainly used for structure, cif, kpoints. E.g. jsmol, chemdoodle

  • filename – name of the file to return its content

  • rtype – return type of the file

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.