Skip to content

Commit

Permalink
Add ERROR_MISSING_OUTPUT_FILES
Browse files Browse the repository at this point in the history
  • Loading branch information
kmlefran committed Jan 23, 2024
1 parent 114df8a commit 0d31fe2
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 3 deletions.
5 changes: 5 additions & 0 deletions aiida_aimall/calculations.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ def define(cls, spec):
)

spec.default_output_node = "output_parameters"
spec.exit_code(
210,
"ERROR_OUTPUT_MISSING",
message="The retrieved folder did not contain the output file.",
)
spec.outputs.dynamic = True

# would put error codes here
Expand Down
5 changes: 2 additions & 3 deletions aiida_aimall/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ def parse(self, **kwargs):
self.logger.error(
f"Found files '{files_retrieved}', expected to find '{files_expected}'"
)
# return self.exit_codes.ERROR_MISSING_OUTPUT_FILES
return
return self.exit_codes.ERROR_MISSING_OUTPUT_FILES

# parse output file
self.logger.info(f"Parsing '{output_filename}'")
Expand All @@ -85,7 +84,7 @@ def parse(self, **kwargs):
# store in node
self.outputs.output_parameters = Dict(out_dict)

return # ExitCode(0)
return ExitCode(0)

def _parse_ldm(self, sum_lines):
return qt.get_ldm(sum_lines.split("\n"))
Expand Down
29 changes: 29 additions & 0 deletions tests/parsers/test_aimqbbaseparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,35 @@ def test_aimqb_parser_default( # pylint:disable=too-many-arguments
assert "cc_properties" in results_dict


def test_empty_outfolder_returns_exitcode( # pylint:disable=too-many-arguments
fixture_localhost,
generate_calc_job_node,
generate_parser,
generate_aimqb_inputs,
fixture_code,
filepath_tests,
):
"""Test an aimqb calculation"""
name = "empty"
entry_point_calc_job = "aimall.aimqb"
entry_point_parser = "aimall.base"

node = generate_calc_job_node(
entry_point_calc_job,
fixture_localhost,
name,
generate_aimqb_inputs(fixture_code, filepath_tests),
)

parser = generate_parser(entry_point_parser)

_, calcfunction = parser.parse_from_node(node, store_provenance=False)
assert (
calcfunction.exit_status
== node.process_class.exit_codes.ERROR_MISSING_OUTPUT_FILES.status
)


def test_gaussiannode_returns_error( # pylint:disable=too-many-arguments
fixture_localhost,
generate_calc_job_node,
Expand Down

0 comments on commit 0d31fe2

Please sign in to comment.