diff --git a/aiida_flexpart/calculations/flexpart_post.py b/aiida_flexpart/calculations/flexpart_post.py index ea19bb3..8d8fe55 100644 --- a/aiida_flexpart/calculations/flexpart_post.py +++ b/aiida_flexpart/calculations/flexpart_post.py @@ -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): @@ -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'] diff --git a/aiida_flexpart/parsers/flexpart_post.py b/aiida_flexpart/parsers/flexpart_post.py index 967bc1f..5ca2168 100644 --- a/aiida_flexpart/parsers/flexpart_post.py +++ b/aiida_flexpart/parsers/flexpart_post.py @@ -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. """ @@ -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): """ @@ -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)