aiida_phonopy.parsers.base#

Defines a Parser base class for aiida-phonopy.

Module Contents#

Classes#

Parser

Custom Parser class for aiida-phonopy parser implementations.

class aiida_phonopy.parsers.base.Parser(node: aiida.orm.CalcJobNode)[source]#

Bases: aiida.parsers.Parser

Custom Parser class for aiida-phonopy parser implementations.

emit_logs(logging_dictionaries, ignore=None)[source]#

Emit the messages in one or multiple “log dictionaries” through the logger of the parser.

A log dictionary is expected to have the following structure: each key must correspond to a log level of the python logging module, e.g. error or warning and its values must be a list of string messages. The method will loop over all log dictionaries and emit the messages it contains with the log level indicated by the key.

Example log dictionary structure:

logs = {
    'warning': ['Could not parse the `etot_threshold` variable from the stdout.'],
    'error': ['Self-consistency was not achieved']
}
Parameters:
  • logging_dictionaries – log dictionaries

  • ignore – list of log messages to ignore

exit(exit_code)[source]#

Log the exit message of the give exit code with level ERROR and return the exit code.

This is a utility function if one wants to return from the parse method and automically add the exit message associated to the exit code as a log message to the node: e.g. return self.exit(self.exit_codes.LABEL))

Parameters:

exit_code – an ExitCode

Returns:

the exit code