diff --git a/aiida/calculations/arithmetic/add.py b/aiida/calculations/arithmetic/add.py index 7f405568f8..19d04b121c 100644 --- a/aiida/calculations/arithmetic/add.py +++ b/aiida/calculations/arithmetic/add.py @@ -28,8 +28,6 @@ def define(cls, spec): spec.input('y', valid_type=(orm.Int, orm.Float), help='The right operand.') spec.input('settings', required=False, valid_type=orm.Dict, help='Optional settings.') spec.output('sum', valid_type=(orm.Int, orm.Float), help='The sum of the left and right operand.') - spec.exit_code(300, 'ERROR_NO_RETRIEVED_FOLDER', - message='The retrieved folder data node could not be accessed.') spec.exit_code(310, 'ERROR_READING_OUTPUT_FILE', message='The output file could not be read from the retrieved folder.') spec.exit_code(320, 'ERROR_INVALID_OUTPUT', diff --git a/aiida/calculations/templatereplacer.py b/aiida/calculations/templatereplacer.py index aa98da7321..2940093b63 100644 --- a/aiida/calculations/templatereplacer.py +++ b/aiida/calculations/templatereplacer.py @@ -73,8 +73,6 @@ def define(cls, spec): spec.output('output_parameters', valid_type=orm.Dict, required=True) spec.default_output_node = 'output_parameters' - spec.exit_code(100, 'ERROR_NO_RETRIEVED_FOLDER', - message='The retrieved folder data node could not be accessed.') spec.exit_code(101, 'ERROR_NO_TEMPORARY_RETRIEVED_FOLDER', message='The temporary retrieved folder data node could not be accessed.') spec.exit_code(105, 'ERROR_NO_OUTPUT_FILE_NAME_DEFINED', diff --git a/aiida/parsers/plugins/arithmetic/add.py b/aiida/parsers/plugins/arithmetic/add.py index 037c9b0ac9..c7c8f4d931 100644 --- a/aiida/parsers/plugins/arithmetic/add.py +++ b/aiida/parsers/plugins/arithmetic/add.py @@ -16,13 +16,11 @@ class ArithmeticAddParser(Parser): def parse(self, **kwargs): # pylint: disable=inconsistent-return-statements """Parse the contents of the output files retrieved in the `FolderData`.""" - try: - output_folder = self.retrieved - except AttributeError: - return self.exit_codes.ERROR_NO_RETRIEVED_FOLDER + if self.node.exit_status == self.exit_codes.ERROR_NO_RETRIEVED_FOLDER.status: + return try: - with output_folder.open(self.node.get_attribute('output_filename'), 'r') as handle: + with self.retrieved.open(self.node.get_attribute('output_filename'), 'r') as handle: result = self.parse_stdout(handle) except (OSError, IOError): return self.exit_codes.ERROR_READING_OUTPUT_FILE @@ -42,8 +40,7 @@ def parse(self, **kwargs): # pylint: disable=inconsistent-return-statements @staticmethod def parse_stdout(filelike): - """ - Parse the sum from the output of the ArithmeticAddcalculation written to standard out + """Parse the sum from the output of the ArithmeticAddcalculation written to standard out :param filelike: filelike object containing the output :returns: the sum diff --git a/aiida/parsers/plugins/templatereplacer/doubler.py b/aiida/parsers/plugins/templatereplacer/doubler.py index 93700a3c2c..5f8b8dc89a 100644 --- a/aiida/parsers/plugins/templatereplacer/doubler.py +++ b/aiida/parsers/plugins/templatereplacer/doubler.py @@ -7,27 +7,21 @@ # For further information on the license, see the LICENSE.txt file # # For further information please visit http://www.aiida.net # ########################################################################### - import os -from aiida.common import exceptions from aiida.orm import Dict from aiida.parsers.parser import Parser -from aiida.plugins import CalculationFactory - -TemplatereplacerCalculation = CalculationFactory('templatereplacer') class TemplatereplacerDoublerParser(Parser): def parse(self, **kwargs): """Parse the contents of the output files retrieved in the `FolderData`.""" - template = self.node.inputs.template.get_dict() + if self.node.exit_status == self.exit_codes.ERROR_NO_RETRIEVED_FOLDER.status: + return - try: - output_folder = self.retrieved - except exceptions.NotExistent: - return self.exit_codes.ERROR_NO_RETRIEVED_FOLDER + output_folder = self.retrieved + template = self.node.inputs.template.get_dict() try: output_file = template['output_file_name'] @@ -73,8 +67,7 @@ def parse(self, **kwargs): @staticmethod def parse_stdout(filelike): - """ - Parse the sum from the output of the ArithmeticAddcalculation written to standard out + """Parse the sum from the output of the ArithmeticAddcalculation written to standard out. :param filelike: filelike object containing the output :returns: the sum