Skip to content

Commit

Permalink
change requests
Browse files Browse the repository at this point in the history
  • Loading branch information
LucR31 committed Dec 20, 2023
1 parent 7828b31 commit 1fff3fd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
6 changes: 3 additions & 3 deletions aiida_flexpart/calculations/flexpart_post.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from aiida import orm, common, engine


class PostProcessingCalculation(CalcJob):
class PostProcessingCalculation(engine.CalcJob):
"""AiiDA calculation plugin for post processing."""
@classmethod
def define(cls, spec):
Expand Down Expand Up @@ -39,14 +39,14 @@ def prepare_for_submission(self, folder):
if 'input_offline_dir' in self.inputs:
params += ['-n',self.inputs.input_offline_dir.get_remote_path()]

codeinfo = datastructures.CodeInfo()
codeinfo = common.CodeInfo()
codeinfo.cmdline_params = params
codeinfo.code_uuid = self.inputs.code.uuid
codeinfo.stdout_name = self.metadata.options.output_filename
codeinfo.withmpi = self.inputs.metadata.options.withmpi

# Prepare a `CalcInfo` to be returned to the engine
calcinfo = datastructures.CalcInfo()
calcinfo = common.CalcInfo()
calcinfo.codes_info = [codeinfo]
calcinfo.retrieve_list = ['grid_time_*.nc', 'boundary_sensitivity_*.nc', 'aiida.out']

Expand Down
17 changes: 9 additions & 8 deletions aiida_flexpart/parsers/flexpart_post.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
"""
from aiida import engine, parsers, plugins, common, orm

FlexpartCalculation = CalculationFactory('flexpart.post')
FlexpartCalculation = plugins.CalculationFactory('flexpart.post')


class FlexpartPostParser(Parser):
class FlexpartPostParser(parsers.Parser):
"""
Parser class for parsing output of calculation.
"""
Expand All @@ -24,7 +24,7 @@ def __init__(self, node):
"""
super().__init__(node)
if not issubclass(node.process_class, FlexpartCalculation):
raise exceptions.ParsingError('Can only parse FlexpartCalculation')
raise common.ParsingError('Can only parse FlexpartCalculation')

def parse(self, **kwargs):
"""
Expand All @@ -39,14 +39,15 @@ def parse(self, **kwargs):
files_expected = [output_filename]
# Note: set(A) <= set(B) checks whether A is a subset of B
if not set(files_expected) <= set(files_retrieved):
self.logger.error("Found files '{}', expected to find '{}'".format(
files_retrieved, files_expected))
self.logger.error(
f"Found files '{files_retrieved}', expected to find '{files_expected}'"
)
return self.exit_codes.ERROR_MISSING_OUTPUT_FILES

# add output file
self.logger.info("Parsing '{}'".format(output_filename))
self.logger.info(f"Parsing '{output_filename}'")
with self.retrieved.open(output_filename, 'rb') as handle:
output_node = SinglefileData(file=handle)
output_node = orm.SinglefileData(file=handle)
self.out('output_file', output_node)

return ExitCode(0)
return engine.ExitCode(0)

0 comments on commit 1fff3fd

Please sign in to comment.