Skip to content

Commit

Permalink
bugfix parser
Browse files Browse the repository at this point in the history
  • Loading branch information
LucR31 committed Feb 24, 2024
1 parent 082bf2f commit 7bfb11f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
5 changes: 3 additions & 2 deletions aiida_flexpart/parsers/flexpart_cosmo.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@ def parse(self, **kwargs):
# add output file
self.logger.info(f"Parsing '{output_filename}'")
with self.retrieved.open(output_filename, 'r') as handle:
output_node = SinglefileData(file=handle)
self.out('output_file', output_node)
content = handle.read()
output_node = SinglefileData(file=handle)
if 'CONGRATULATIONS' not in content:
self.out('output_file', output_node)
return ExitCode(1)

self.out('output_file', output_node)
return ExitCode(0)
7 changes: 2 additions & 5 deletions aiida_flexpart/parsers/flexpart_ifs.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,13 @@ def parse(self, **kwargs):
return self.exit_codes.ERROR_MISSING_OUTPUT_FILES

# check aiida.out content
self.logger.info(f"Parsing '{output_filename}'")
with self.retrieved.open(output_filename, 'r') as handle:
content = handle.read()
output_node = orm.SinglefileData(file=handle)
if 'CONGRATULATIONS' not in content:
self.out('output_file', output_node)
return engine.ExitCode(1)
# add output file
self.logger.info(f"Parsing '{output_filename}'")
with self.retrieved.open(output_filename, 'rb') as handle:
output_node = orm.SinglefileData(file=handle)
self.out('output_file', output_node)

self.out('output_file', output_node)
return engine.ExitCode(0)

0 comments on commit 7bfb11f

Please sign in to comment.