aiida.parsers package

aiida.parsers.ParserFactory(module)[source]

Return a suitable Parser subclass.

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]

Parses the datafolder, stores results. Main functionality of the class. If you only have one retrieved node, you do not need to reimplement this. Implement only the parse_with_retrieved

parse_with_retrieved(retrieved)[source]

Receives in input a dictionary of retrieved nodes. Implement all the logic in this function of the subclass.

Parameters:retrieved – dictionary of retrieved nodes
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