From 7bfb11f1eac4ff3e4925ade36d6d0205f59914b2 Mon Sep 17 00:00:00 2001 From: LucR31 <94859181+LucR31@users.noreply.github.com> Date: Sat, 24 Feb 2024 06:13:02 +0000 Subject: [PATCH] bugfix parser --- aiida_flexpart/parsers/flexpart_cosmo.py | 5 +++-- aiida_flexpart/parsers/flexpart_ifs.py | 7 ++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/aiida_flexpart/parsers/flexpart_cosmo.py b/aiida_flexpart/parsers/flexpart_cosmo.py index ed8c81a..0314bf0 100644 --- a/aiida_flexpart/parsers/flexpart_cosmo.py +++ b/aiida_flexpart/parsers/flexpart_cosmo.py @@ -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) diff --git a/aiida_flexpart/parsers/flexpart_ifs.py b/aiida_flexpart/parsers/flexpart_ifs.py index fa57341..1483596 100644 --- a/aiida_flexpart/parsers/flexpart_ifs.py +++ b/aiida_flexpart/parsers/flexpart_ifs.py @@ -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)