aiida.parsers package

aiida.parsers.ParserFactory(entry_point)[source]

Return the Parser plugin class for a given entry point

Parameters:entry_point – the entry point name of the Parser plugin

Submodules

exception aiida.parsers.exceptions.FailedJobError[source]

Bases: aiida.common.exceptions.ValidationError

__module__ = 'aiida.parsers.exceptions'
exception aiida.parsers.exceptions.OutputParsingError[source]

Bases: aiida.common.exceptions.ParsingError

__module__ = 'aiida.parsers.exceptions'

This module implements a generic output plugin, that is general enough to allow the reading of the outputs of a calculation.

class aiida.parsers.parser.Parser(calc)[source]

Bases: object

Base class for a parser object.

Receives a Calculation object. This should be in the PARSING state. Raises ValueError otherwise Looks for the attached parser_opts or input_settings nodes attached to the calculation. Get the child Folderdata, parse it and store the parsed data.

__dict__ = dict_proxy({'__module__': 'aiida.parsers.parser', 'retrieved_temporary_folder_key': <property object>, 'parse_with_retrieved': <function parse_with_retrieved>, 'get_result': <function get_result>, 'get_result_keys': <function get_result_keys>, 'get_result_parameterdata_node': <function get_result_parameterdata_node>, '__weakref__': <attribute '__weakref__' of 'Parser' objects>, '__init__': <function __init__>, 'get_linkname_outparams': <classmethod object>, '__dict__': <attribute '__dict__' of 'Parser' objects>, 'logger': <property object>, 'parse_from_calc': <function parse_from_calc>, 'get_result_dict': <function get_result_dict>, '__doc__': '\n Base class for a parser object.\n\n Receives a Calculation object. This should be in the PARSING state.\n Raises ValueError otherwise\n Looks for the attached parser_opts or input_settings nodes attached to the calculation.\n Get the child Folderdata, parse it and store the parsed data.\n ', '_linkname_outparams': 'output_parameters', '_retrieved_temporary_folder_key': 'retrieved_temporary_folder'})
__init__(calc)[source]

x.__init__(…) initializes x; see help(type(x)) for signature

__module__ = 'aiida.parsers.parser'
__weakref__

list of weak references to the object (if defined)

_linkname_outparams = 'output_parameters'
_retrieved_temporary_folder_key = 'retrieved_temporary_folder'
classmethod get_linkname_outparams()[source]

The name of the link used for the output parameters

get_result(key_name)[source]

Access the parameters of the output. The following method will should work for a generic parser, provided it has to query only one ParameterData object.

get_result_dict()[source]

Return a dictionary with all results (faster than doing multiple queries)

Note:the function returns an empty dictionary if no output params node can be found (either because the parser did not create it, or because the calculation has not been parsed yet).
get_result_keys()[source]

Return an iterator of list of strings of valid result keys, that can be then passed to the get_result() method.

Note:the function returns an empty list if no output params node can be found (either because the parser did not create it, or because the calculation has not been parsed yet).
Raises:UniquenessError – if more than one output node with the name self._get_linkname_outparams() is found.
get_result_parameterdata_node()[source]

Return the parameterdata node.

Raises:
logger

Return the logger, also with automatic extras of the associated extras of the calculation

parse_from_calc(retrieved_temporary_folder=None)[source]

Parse the contents of the retrieved folder data node and return a tuple of to be stored output data nodes. If you only have one retrieved node, the default folder data node, this function does not have to be reimplemented in a plugin, only the parse_with_retrieved method.

Parameters:retrieved_temporary_folder – optional absolute path to directory with temporary retrieved files
Returns:exit code, list of tuples (‘link_name’, output_node)
Return type:int, [(basestring, aiida.orm.data.Data)]
parse_with_retrieved(retrieved)[source]

This function should be implemented in the Parser subclass and should parse the desired output from the retrieved nodes in the ‘retrieved’ input dictionary. It should return a tuple of an integer and a list of tuples. The integer serves as an exit code to indicate the successfulness of the parsing, where 0 means success and any non-zero integer indicates a failure. These integer codes can be chosen by the plugin developer. The list of tuples are the parsed nodes that need to be stored as ouput nodes of the calculation. The first key should be the link name and the second key the output node itself.

Parameters:retrieved – dictionary of retrieved nodes
Returns:exit code, list of tuples (‘link_name’, output_node)
Return type:int, [(basestring, aiida.orm.data.Data)]
retrieved_temporary_folder_key

Return the key under which the retrieved_temporary_folder will be passed in the dictionary of retrieved nodes in the parse_with_retrieved method